Alex Brooke

Music and tech in Tokyo

Browsing Posts tagged tutorial

This is a tutorial on how to make a very simple AS3 (CS4) preloader for your Flash movies. This tutorial assumes you are a beginner at Flash.

 preloader

1) Create a new flash document and  a draw rectangle on the stage. This will be our preloader bar.

2) Select it, then click Modify in the top menu and then Convert to symbol

3) Give it any name you like and make sure that the Type is selected to Movie Clip. Also make sure you select the middle left box on the registration point as we want it to expand from left to right. Click OK to save.

 symbolconvertclick to enlarge

4) Underneath the preloader bar you just drew, insert a dynamic text field.

5) Give the preloader bar an instance name of “loaderBar” and give the text field an instance name of “loaderText”

 loaderbarinstancename

 textinsatncename

6) Make a new layer above the current one and label it “actionscript”. You can also give the bottom layer a name such as “bar” if you want.

 actionscriptlayer

Click on the first frame of the actionscript layer and open the actions window. (Click Window and then Actions in the top menu)

7) Insert the following code:

stop();
import flash.display.*;
this.stop();
this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, PRELOADER);
function PRELOADER(event:ProgressEvent):void {
var percent:Number=event.bytesLoaded/event.bytesTotal*100;
loaderBar.scaleX=pcent/100;
loaderText.text=int(percent)+”%”;
if(percent==100){
this.gotoAndStop(2);
}
}

8) Make a new blank frame at frame two of the layer with the preloader bar you drew and import a picture so we have something to load.

9) Click Control and then Test Movie and… it won’t work properly. As you are loading this file from your computer, it will load instantaneously. We need to slow down the load rate for us to check it works.

10) Click on View in the top menu and then Simulate download. You should now see your preloader bar slowly expand with the progress in a percentage underneath. If you are still having problems you can adjust the download simulation rate in View and then Download settings

 flashiconDownload the example file here

NOTES

If you have an animation that plays from frame 2 onwards you can change the line “this.gotoAndStop(2);” to “this.gotoAndPlay(2);”

Please leave your questions, comments and responses to this article. Please let me know of any mistakes, inaccuracies or problems with this tutorial and I’ll try to fix it. Enjoy!


Of course, we don’t always want to be happy, serene and contented. If like me you want to add a little anger, frustration and confusion into your life here are two tips that will lead you down the dark path of endarkenment. (This won’t work for people with Phds in computing)

1) Install wordpress

2) Now try to get jQuery to work.

3) Now watch your frustration, anger and insanity grow as NOTHING BLOODY WORKS

Of course those familiar with computers know that nothing does what it is supposed to and computers are crap.

However, if the above doesn’t appeal to you, I did find this tutorial which shows you how to install a text hide effect. And it actually  bloody works. I literally fell off my chair when it did what it was supposed to do. Here’s an example of it in action on my Learn Japanese site. Click “click for the  answers”.

Feeling serene again? Well, you could always try getting it to work in Internet Explorer…mu ha ha ha….

UPDATE

I was wrong. I’m too dumb to get JQuery to work in WordPress. There are too many conflicting scripts that result in unpredictable bugs, hair pulling and much swearing at the computer screen. Even ready made jQuery based plugins for wordpress don’t play nicely together.

Then we have these effingly annoying version updates for wordpress which means that you have the choice of either having plugins that work with an out of date version, or a new version where none of the plugins have been tested.

Sod it, I’m staying with Flash. And no, I don’t care about Flash being crap for google indexing, make great content and people will find you site anyway…says I (just some other idiot with blog about blah, blah, blah and whatever)

How to Embed a video in an SMF forum

Here is a little tutorial I did with the aid of Coffeebot, Olly and a few 500 milliliter cans of Kirin beer. People had had trouble posting videos on the Learn Japanese Pod forums so I thought this would help some people out. We use Simple Machines Forums for our forums so this tutorial should help you out if you are using the same one. I should also mention this is not necessarily an endorsement for SMF, we installed it, people joined and it’s the one we got stuck with. It’s not the worst but you might want to try the alternatives before eventually giving up and intalling this one anyway…