PDA

View Full Version : attach script on an instance...


lse123
06-15-2007, 05:00 PM
when in a book read "... attach script on an instance...", this means on the timeline of the instance frame 1, Actions layer ?

_Aerospace_Eng_
06-15-2007, 06:48 PM
Almost. Basically if you gave a symbol an instance name you would be able to reference that instance to use actionscript on it. For example. If I have a button with instance name button1 and I want to use getURL on this button but I don't want to put actionscript directly on the button. I would go to my actions layer and use this
button1.onRelease = button1.onReleaseOutside = function()
{
getURL('http://www.google.com');
}
I set onRelease and onReleaseOutside equal to each other because I want them to do the same thing.

lse123
06-16-2007, 11:42 AM
You mean this on the instance timeline , or in the main timeline ?

_Aerospace_Eng_
06-16-2007, 03:21 PM
It doesn't matter. As long as the symbol has an instance name you can attach actionscript to it from any part of the timeline. Not really that hard to comprehend.