|
|||||||
| Tutorials:click_to_load | ||||
|
Suppose you have a large SWF file you want to use as a signature. You don’t want to force the users to download your massive signature unless they want to view it - so you need a placeholder or Click to Load script. The user clicks on your placeholder movie and the placeholder loads your massive sig. The user sees the preloader on your sig if you created one. No lag and everyone is happy. Fortunately this is very easy in Flash 9 / Actionscript 2. There is only one rule: Your placeholder movie must exist on the same subdomain as the movie you want to load. That means if your sig is at joe.domain.com and your placeholder movie is at dave.domain.com this wont work. The placeholder would have to exist at joe.domain.com. 1. If you have CS3, start a new Actionscript 2 project, otherwise just start a new project. 2. Make your placeholder the same size and framerate as your sig: go to Modify > Document… and set the height and width properties and the framerate to match your signature, or target file. 3. You’re going to make a button in the middle of your stage. You can make this look however you want. Click the rectangle tool in flash and draw a rectangle in the middle of the screen. 4. You’ll need some text so the user knows what to do. Click on the text tool. Choose a color for the text other than white (unless that’s what you want) and make sure in the properties panel you have “Static Text” selected. Write the phrase “Click to Load” in the middle of the screen on the rectangle.
4a. (Optional Step) If you want everything centered, do this: Click the arrow tool. go to Edit > Select All. go to Window > Align. Make sure the to stage button is active. Click on the Align horizontal center and align vertical center buttons (top row, 2nd and 5th buttons), and then press ESC or click somewhere to de-select everything. 5. You want to turn this into a button now: With the arrow tool selected, draw a box around the rectangle to select everything on it and then press F8 (or Modify > Convert to Symbol…) Make it a button and you can accept the default name. Click OK. 6. You now want to add actionscript that loads your sig when the user clicks the button. Click the button to select it. Window > Actions or press F9 to open the actions window for the button. Verify that the window that appears says “Actions - Button” at the top. If it says something about Movie Clip or Frame actions, you’re editing the wrong thing. 7. Enter the following in the box:
on(release) {
loadMovie("http://www.domain.com/mysignature.swf","_root");
}
now, you want to substitute the //http://www.domain.com/mysignature.swf// URL with your own URL.
8. Play the movie (Ctrl-Enter). When the movie plays on your local computer, the security settings are lifted, so the rule about the subdomains dosen’t apply right now. Make sure your sig loads. If it dosent, try entering the URL into a browser - make sure it’s correct and then check your code. (click on the button and then press F9 for the code) 9. Save it, give it a good name, publish it and then upload it! Remember - it needs to live on the same subdomain as your movie. Hope this helps. As always PM me with any suggestions or comments! –PineappleClock |