Action Script Help inside FlashMX 2004 Pro

MainFramed

Diamond Member
May 29, 2002
5,981
1
0
I am trying to link my buttons (they are buttons w/ the up over down and hit properties. ) I don't know how to make the buttons work as links and so that the links open in my "content" target. I thought I had it figured out by adding this to the script box when clicking on the button:


When I check the syntax for erros I get this:
**Error** Scene=Scene 1, layer=Layer 4, frame=35:Line 1: Statement must appear within on handler
getURL("http://mainframed.com/about.htm", "_content")

Total ActionScript Errors: 1 Reported Errors: 1

Anyone know what im doing wrong? Or how to link buttons so that they actually launch (and into a certain target)?

I would appriacte all your help guys. TIA

- Joe:confused:
 

rh71

No Lifer
Aug 28, 2001
52,844
1,049
126
this is one way to do it (I use it on my rh71.com --> resume)...

Your "target" space needs to be a container.. meaning you need to use movieClips. I haven't done this in a while, but it goes something like this... create a new movie clip (name it aboutClip) and within aboutClip you will create a dynamic text box (input box) the size of the content area of your about.html. Don't forget to put a stop() action at the last frame of aboutClip so it doesn't loop when activated.

Now go back to your main timeline, create a keyframe on the timeline where it will go (again, use a stop() action to keep it from going to another section) and drag aboutClip from your library onto your main movie, where you want it to appear when your About button is clicked. You must name the movieclip (give it an Instance Name) on the main timeline so you can refer to it via actionscript (your button will call it). Name it something like "aboutMC" in the properties box.

Your button now needs to "activate" it... so your button's action should be:

on (release) {
gotoAndPlay("About section"); // use this only if you have stop actions on your main timeline - labels are a big help
loadVariables("about.html", "aboutMC");
}

One last thing I should mention... using loadVariables will render your .html a bit differently. Actual whitespace in your .html will be rendered as spaces. As will line breaks, etc. You will have to play with the format of your .html file to get it to show properly (it was a good thing for my resume formatting). The reason is because loadVariables() is meant for text files.

That should be it. You can do all other loaded contents the same way... by using containers.