First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Frets

The Example

go ahead and try it

If you've tried it twice once by using the enter key and once by using the Press button you'll notice you get two different results. That's because I've assigned two different expressions to the dynamic text box. But thats for later on Lets work on some basics first. <%BK%>

Input Text

  • Select the text button from the layout panel left of the stage.
  • Click and drag to create a text block.
  • Go To the Text Panel on the right.
  • Name your text see note for the sake of arguement lets call it Inny
  • Do Not select it as a target
  • The Defaut setting for text is Static Click on the word static and use the drop down to select Input.
  • Select Advanced from the Drop down menu that says Dimensions.
  • Select the Black Box icon and deselect Multi line for this example.

Input Text

Due to reserved words being used in actions/expressions it's wise not to use certain words such as "text, Sprite, parent child or using the same word for multiple objects (sprites with the same name text with the same name etc) as well never start a name with a number swish will try to correct it if you do but in general it's a bad practice)
Test your movie out hit scene play you should be able to back out any text and replace it with new text. What have you done. You have created a variable for storage. A variable is simply a box that holds data. Data can be stored locally on to a computer or onto a server. Because we are just starting out the data is only temporary. Later you may wish to learn more about storing data such as cookies, shared objects or to a database. But for now lets keep it simple. Variables aren't always text although it is the default setting for swishmax. Swishmax can interpert variables to a certain degree somevariables such as currency or boolean statements(true false) must be defined as such although swishmax does a pretty good job of figuring out what type of variable is being stored. We'll discuss a bit more about variables later on. For now lets take a break and create our Dynamic text. <%BK%>

The Dynamic Text block

Just as Before,,,
  • Create a text block on the stage by selecting the Text icon on the layout panel and dragging across the stage.
  • Give your new text box a new name Lets call it Outty.
  • For the sake of arguement (and to simply the process) Do Not select it as a target. From the type of text Select Dynamic (it should have been left at Input)
  • As you should still be in the Advanced tab deselect the black box.
  • From the Advanced button Select Formatting.
  • Select text wrap (the icon that looks like an enter/return button)
  • From the Formatting button go back to Dimensions
  • Deselect Auto Height Icon with the A Click where it says Hieght and select Lines insert the number of lines you think you will need.
  • Now clear out any text you have in Outty.
Output Text
Take a break breathe let it all soak in. Here comes the last part. <%BK%> Back already? Well okay I'm sure you want to get this stuff done with.

Our Button

Create Select the object you want to act as a button. (text shape anything but the input or dynamic've just created.
  • Go to the script panel
  • Add Script>Event>Button>OnRelease
  • Add Script>Statements>name=expr
  • Leave target blank. Targets refer to Sprites
  • Name:the name of the dynamic text Outty remember our dynamic text box name was Outty
  • Property: =
  • Expression: Inny
  • What you should see is
    On Release()
    {Outty = Inny;)


Go back to the stage view and test your movie
So where did all that other stuff come from? And how can I do that? When you use a variable in an expression you simply include the name. When however you wish to use Text or what the rest of the programming world refers to as a String you encase the expression in quotation marks. When "1"+"1"="11" Concetation is when strings and or variables are is not intended as a mathematical formula simply a means of bringing two or several strings and or variables together Such as MyVar1 add" some stuff goes here." +MyVar2 add" more Stuff"; About the Enter Key,,,,, If you wish to use a keypress function you may.... Use the Event Button>On kepress<"enter"> Where to go from here. Once you get the hang of dynamic text expressions and input text it is much easier to digest things such as Loading and sending variables.creating mathematical equations and dancing with squirrels. Why the stuff about not making dynamic/input text a target? When you make any object a target you change the nature of the object it now becomes wrapped in a sprite. Which is why if you made your text objects target you recieved and error in the debug stating cannot find target. "targets" are great for simplifying draggable objects or when you simply want to load something such as a movie into a rectangle. However for the most part many of us are simply used to converting objects to sprites for the added benifits they bring. If you associate dynamic text (as in the case when you want it to be a target) with a variable meaning have a different name for the variable then the text object. Personally I see it as one more step that really is never absolutely required When you do associate dynamic text with a var name the two cannot have the same name. Still struggling? here's the SWI
» Level Basic

Added: 2005-05-22
Rating: 4.21 Votes: 14
(10 being the highest)
» Author
Flashkit Supermoderator, Swishzone Supermoderator, Swish-Talk Supermoderator
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.