Copy link to clipboard
Copied
Hi,
I used to use flash mx 2004, can not believe it was over 10 years ago. I got really into making games at the time and recently realised I want to use flash for a project im working on. Tried installing my old program but its not very well supported on windows 8 understandably, so i got CC.
My question is really about how you can write actionscript. in the old version you could write script on frames or on symbols. so for buttons I would select the symbol and the actionscript panel would show different code to the frame, then everything you wrote would be related to this button, eg.
on (release) {
stop();
}
i cant figure out how to do this in the new version, has it all been moved to the frame?
so in that case would you write something into the frame that is along the lines of:
buttonname.on (relase) {
stop();
}
thanks for the help! i am asking really because i drew out how i plan to make my project based on using symbol - assigned script, and changing method will be a bit of work. does it make sense to write all the code into a separate layer with only one keyframe?
all the best,
Andy
Copy link to clipboard
Copied
:
buttonname.addEventListener(MouseEvent.CLICK,buttonF);
function buttonF(e:MouseEvent):void{
stop();
}
p.s. it's best to use class files. ie, it makes things easier to edit if you use class files. but that's a big change for you so if you're going to add code to timelines, it's best to limit the location(s) of your code. except for stop(),play() and goto's one layer of one frame is the 2nd best.
Copy link to clipboard
Copied
The CC version of Flash does not support the version(s) of Actionscript you are familiar with. Flash CC only supports Actionscript 3. In AS3 you can only have code in the timeline or in separate AS files.
The equivalent code for what you show would be...
buttonname.addEventListener(MouseEvent.CLICK, stopTimeline);
function stopTimeline(evt:MouseEvent):void {
stop();
}
The user-named elements of that code are shown as blue text. The rest is AS3 code.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now