Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-25-2012, 01:32 PM   #1
gandalf458
Member
 
Join Date: Jul 2008
Location: Paciano, Italy
Posts: 53
Default Changing onPress events to functions

I have a simple movie in Flash 8 which plays a specified mp3 file, I'm trying to change it so that instead of using onPress events it uses functions [not sure of the correct terminology]. The original is at gandalf458.co.uk/playonce.fla and my initial attempt gandalf458.co.uk/playonce2.fla -I'm not sure where to go from here. Can anyone guide me please?
gandalf458 is offline   Reply With Quote
Old 03-23-2012, 08:35 PM   #2
adninjastrator
Senior Member
 
Join Date: Feb 2010
Posts: 220
Default

Changing from a onRelease (for example) event to a function is pretty simple.
Code:
play_btn.onRelease = function() {
	gotoAndStop(10);
}
Keep all actionscript in it's own layer and not on the button itself.
So create a movie clip that will act as your button, give it an instance name and then with dot notation, append the action onRelease or whatever to the button name
play_btn.onRelease
then define the function... see example above.
Start with something very simple and easy... all by itself in a new Flash doc.
Create a button in frame one along with a stop(); and then in a separate layer put in the function actionscript.
Do a simple gotoAndStop in frame 10 or so... in frame 10 put a big blue box.
Once you verify that your function is working, then adapt into your real project.
Best wishes,
Adninjastrator
adninjastrator is offline   Reply With Quote
Old 03-24-2012, 08:25 AM   #3
gandalf458
Member
 
Join Date: Jul 2008
Location: Paciano, Italy
Posts: 53
Default

Thanks Adninjastrator. That's very helpful.
gandalf458 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:04 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.