Over 16,644,609 people are on fubar.
What are you waiting for?

Global Variables

Yep, these lovely things span from Los Angeles to the heart of Tokyo...maybe. What a global variable is in Actionscript is a variable you can access from ANYWHERE in your Flash file. Once you define it as a global... _global.variableName=value; you can change its value ANYWHERE by simply calling it and changing the part that says "value". These are different from other variables in that others can only be used in the code window they're placed in. If you have a variable named Pinky, for instance, defined in a movie clip... var Pinky; you can't change it in another movie clip, button, or key frame. You can access its value using a relative path... this._parent.randomMovieClip.Pinky (yes, you have to type the whole thing so the file knows where to look) but you can't change its value outside the window in which it was defined, or Flash is going to treat it like an entirely different variable. Globals make variables easier to manage if you have more than one code window, so try using them for video games, animated web sites, and what-not.
You just built a complicated web site out of a dozen separate Flash files, so what do you do when your computer crashes and you have to reformat to use it again? Well, before that happens, there is something very simple you can do. Zip it. No, no, I'm not telling you to shut up. Send your raw Flash documents to a compressed folder, and upload them all to your web site, preferably not in the main public folder. That way, should your computer go bye-bye, and you have to start over, all you have to do is access your web site from the back door and download those zipped files. Extract them, and you have all of your progress ready to update. I wish I had done that last time...check out my new review for Spiderman 3 on aeldar.com and you'll see that I had to completely rebuild the review template as well. I'm not going to redo every single review I ever made, so all of the new ones will look different. I have 112 reviews now, and it would take forever to change them all to one format. So prevent doing what I did. Zip and upload your finished raw Flash files (.fla) to your web site. Everything you see on the site, save the reviews and pdf story samples, has been rebuilt in the last three weeks, and I did it fast.
Okay, you have made a movie clip, and you want it to change. Problem is, you have more than one change to make depending on the results of a user action or what-have-you... What do you do? Simple. You take the variable and put it into one of two types of condition statements: If or Switch-Case. The syntax is different for the If than it is for the Switch, but they do the same thing. They take the variable and give you different results depending on its value. "If" conditions are like Boolean variables. The result is based on True or False, or in the case of the Boolean variable, 1 or 0. "Switch" conditions give you three or more possible results. The SWITCH takes the variable and tells the rest of the statement to make a decision based on it. CASE is where the variable is tested for value, and it gives you a result based on one of many possibilities. if(variable1>=3){ gotoAndStop(2); } The above tells the file to go to frame 2 and stop there if the variable is at least a value of 3. You can add an ELSE statement after it, but I only suggest it if you don't want to mess with the SWITCH. switch(variable1){ case variable1>=3&&variable1<6: gotoAndStop(2); case variable1>=6&&variable1<9: gotoAndStop(3); } if(variable1>=3&&variable1<6){ gotoAndStop(2); }else{ if(variable1>=6&&variable1<9){ gotoAndStop(3); } as you can see, it takes less logical confusion to use the switch statement then it would to use an IF-Else. The way to read the above is: if variable1 is greater than or equal to 3, and less than 6, then go to and stop on frame 2...if it's greater than or equal to 6, and less than 9, then go to and stop on frame 3. The syntax is radically different between the two, so you should definitely decide which one would work best BEFORE you type it out.
First off, you probably have some idea what you want your animation to be. If not, then figure it out and make it yourself, because there are just WAY too many possibilities there. Once you have your idea made and animated (preferably with a gif animator like Photoshop or (my favorite) Ulead, you're ready to make it into a button. Flash can export gif files, but they come out REALLY grainy, so go with a dedicated gif animator. It just looks better, trust me. The first thing you want to do is open an unnamed, empty movie clip. Hit CTRL+F8 to do this, and you will open a new window with nothing in it and a generic title. Import your animation by hitting CTRL+R, and resize it to what you want your button to be. Now why are you making a movie clip instead of a button? Because porcupines are spiny. Just kidding. You have to use this movie clip because the button is only going to be on one frame itself. When you have your animation in the movie clip, go ahead and return to Scene 1 and open your library by hitting F11 in the main file window. Your new movie clip should be in your library. Drag it out of the preview window to the place you want it on the stage. Now you're asking, "Why is this only one frame? I wanted an animation, not a still-frame picture, jacka$$!" First, go find yourself a chill pill and swallow it, jumpy. When you run the swf file, the animation INSIDE the movie clip will play in that one frame. I could get more technical, but not this time. Now you have an animated piece on your page, but your cursor still isn't going to respond to it. You have to take that movie clip and put it inside a...(wait for it, la la la)...BUTTON. Select it and hit F8, choose the Button option and name it what you will, hit Enter, and voila! You're done. You have a shiny new animated button and it comes with a ten-year warranty...okay, not really, but you have the animated clickable thingy now. What you do with this button is up to you, young grasshoppa.
When you enter a web site, the first thing you likely notice is the text elements. When you may not know is that these text elements may be nothing more than graphics and not text at all. If anything, any text you put on your web site should be one of the three universal fonts: Times New Roman, Arial, or _Sans Serif (the serif is the little lines that appear on the top and bottom of your text). However, if you want your text to look more flashy, say like this, you'll have to trick the eye. Some less powerful computers do not have any extra fonts available, so if you want them to see your fancy font on their web browser, you DO have an option.

Change your text into a graphical element.

What this does is it takes that font and the text values out of the file and basically replaces it with a picture of the words in that font. All their computer has to load is a picture instead of a line of formatted text in a font they might not be able to see.

Now you're saying, "Okay, Dave, that's all well and good, but how the f*ck do I do that?"

Okay, first of all, calm down. ;)
Then select the text you want to change (be damned sure you won't want to change it afterward, because once it's a graphical element, your system won't see text any more) and hit [CTRL]+[B] twice. The first time, it will break the text line into individual characters, so that each letter, space, comma and what-have-you becomes its own text element instead of just one line. The second time you hit that combination will break every letter into a bunch of dots, reversible ONLY by undoing that very action.

So why go through all this trouble to change the graphical quality of your text? Simple. Others might not have that font you want to use, but they can still see a picture well enough to read it.

It's Time for Round Two!

Today's tip is How to Make an Invisible Button. First thing you need to do is make a rectangle using the Rectangle tool. Don't worry about the color, shape or anything yet, since it can all be changed at any time, and the color won't be visible anyway. Double-click said rectangle to select the Stroke and the Fill, and hit [F8] on your keyboard. This will bring up the object creation dialogue box. The name of the object will be highlighted, so just type the name you want in the text box. I prefer to name my objects with no spaces and each word in the name capitalized. LikeThisPhrase. Now before you hit [ENTER], you want to check the option beside the word "Button". Now you can double-click on the rectangle, and then change the shape to whatever you want. Now most of the time, you'll want an invisible button because you want a text link without the html-style interface, so add a new layer inside the button, make sure you're on the new layer, and enter the text you want in whatever format you like. You'll want to go back to the original layer and reshape your rectangle using the corner grips of the Shape Transform tool, and make it fit the text better. After you have done this, make sure the rectangle is still selected and hit [F8] again. Name the new object and this time select the "Movie Clip" option. With the new movie clip selected, go into your Properties panel and click on the text box that says "Color". Select "Alpha" and set the number value to zero (0). The rectangle will now be invisible. Go into the layers list and select the frames beneath the word "Down" and press [F6] to add the keyframes (VERY IMPORTANT, otherwise the button will not work). Go up to your project browser and click on Scene 1, and your button is now available graphically. It will look like just a word or phrase of text, but the entire space around the button text will work, thanks to the rectangle you turned invisible. Now just code the button based on what you want it to do, and you're finished. I may offer a tip later on about options to use the button for, but it'll take a while to explain them all. Happy Flashing!
last post
17 years ago
posts
6
views
1,446
can view
everyone
can comment
everyone
atom/rss

other blogs by this author

 15 years ago
projects
 16 years ago
Me So Fickle...
 16 years ago
Watch Out...
 16 years ago
random junk
 16 years ago
Why I came here...
 16 years ago
Work Blogs...Fun
 17 years ago
Character Bios
 17 years ago
Writing Tips
official fubar blogs
 9 years ago
fubar news by babyjesus  
 14 years ago
fubar.com ideas! by babyjesus  
 11 years ago
fubar'd Official Wishli... by SCRAPPER  
 11 years ago
Word of Esix by esixfiddy  

discover blogs on fubar

blog.php' rendered in 0.0505 seconds on machine '179'.