Small Basic > Curriculum > Online > Lesson 5: Sharing Code



Estimated time to complete this lesson: 1 hour

Sharing Code

In this lesson, you will learn how to:

  • Share your Small Basic programs.
  • Download and run Small Basic programs.
  • Publish Small Basic programs for the Microsoft Silverlight ® browser plug-in.

Now that you have explored Small Basic to create fun games and applications, it is time to share your creations with your friends and colleagues.

You can share your Small Basic programs by uploading your code to the Internet.

Small Basic programs

To upload your code, you connect to the Internet and then click Publish on the toolbar.

Uploading The Code

When you click the Publish button, your program is published instantly!

Small Basic generates and displays a unique ID for your program. Using this ID, you can share your program with others.

Microsoft Small Basic

You can also give your program a suitable title, provide a brief description, and define the category for your program.

To access your program in a different Small Basic environment, you can use the unique ID that is assigned to your program. You can also view your program online by accessing the displayed URL.

Downloading a Program

Now, let’s explore how others can access your published program within the Small Basic environment.

To access your published program in Small Basic, you click Import on the toolbar.

Small Basic
Microsoft Small Basic

You must then specify the unique program ID and then click OK.

The particular program is imported from the Internet and appears in your Small Basic environment.

GraphicsWindow.Title = "Fun with the Turtle"
GraphicsWindow.Height = 300
GraphicsWindow.width = 500

Turtle.Show()
Turtle.Speed = 10
Turtle.X = 150
Turtle.Y = 150
For i = 0 TO 200 Step 5
  GraphicsWindow.PenColor = Graphicswindow.GetGetRandomColor()
     Turtle.Move(i)
     Turtle.Turn(90)
EndFor
Turtle.PenUp()
Turtle.Move(260)
Turtle.Turn(60)
Turtle.Move(120)
Turtle.PenDown()
For i = 0 To 200 Step 5
  GraphicsWindow.PenColor = Graphicswindow.GetGetRandomColor()
     Turtle.Move(i)
     Turtle.Turn(120)
EndFor

 

Running a Program

After you import a program into your Small Basic environment, you can run the program or edit the code.

GraphicsWindow.Title = "Fun with the Turtle"
GraphicsWindow.Height = 300
GraphicsWindow.width = 500

Turtle.Show()
Turtle.Speed = 10
Turtle.X = 150
Turtle.Y = 150
For i = 0 TO 200 Step 5
  GraphicsWindow.PenColor = Graphicswindow.GetGetRandomColor()
     Turtle.Move(i)
     Turtle.Turn(90)
EndFor
Turtle.PenUp()
Turtle.Move(260)
Turtle.Turn(60)
Turtle.Move(120)
Turtle.PenDown()
For i = 0 To 200 Step 5
  GraphicsWindow.PenColor = Graphicswindow.GetGetRandomColor()
     Turtle.Move(i)
     Turtle.Turn(120)
EndFor

 

Click Run on the toolbar.

This is the output you will see:

Output

You can also save the imported program by clicking Save on the toolbar.

Accessing Your Program Online

Moreover, you can access your published program online!

When you publish a program, it gets uploaded to the website for Small Basic. By browsing to the website and specifying the unique program ID, you can access your program online, anytime, within a web browser that supports Silverlight. So have fun creating Silverlight applications and games right from within Small Basic!

The webpage also displays the code sample for your program below the program output.

Program Output
Program Output

Embedding your Program Online

As you know, you can view your published programs on the Small Basic website from within a web browser that supports Silverlight. Well, Small Basic has more to offer!

You can simply embed your program within your website. The Small Basic website provides the HTML code exclusively for your program.

Microsoft small Basic Program Listing

You can host your published program on your own website or blog by simply copying the code into your website code. Simple, isn’t it?

Let’s Summarize…

Congratulations!

Now you know how to:

  • Share your Small Basic programs.
  • Download and run Small Basic programs.
  • Publish Small Basic programs for Silverlight.

Show What You Know

Now that you know some facts about Small Basic, you can check your learning by answering the following questions:

  • How can you share your Small Basic program online?
  • How can you access your published program in another Small Basic environment?

To see the answers to these questions, go to the Answer Key page.

Next Lesson

PowerPoint Downloads