|
|
|
|
Thread title: flash play on click |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
08-27-2007, 03:16 PM
|
#1
|
Status: Member
Join date: Dec 2006
Location: Torrington, Ct, USA
Expertise:
Software:
Posts: 127
|
flash play on click
i have an animated banner that plays and stops. how do i make it play on click? other than the reload.
thanks
|
|
08-27-2007, 03:47 PM
|
#2
|
Status: Request a custom title
Join date: Feb 2006
Location: Nottingham
Expertise:
Software:
Posts: 1,648
|
Code:
myElement.onclick = function() { play(); }
|
|
08-27-2007, 06:05 PM
|
#3
|
Status: Member
Join date: Dec 2006
Location: Torrington, Ct, USA
Expertise:
Software:
Posts: 127
|
mabey i didnt put it in right. i made a new layer called action and put the code in the first frame. once the movie is done playing will this script make it play again on click?
|
|
08-27-2007, 07:34 PM
|
#4
|
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
Posts: 2,246
|
if you put play(); in the first frame, it just tells a movie that's already playing to play. when it reaches the end, there's no new code to execute.
in your new layer, go to the last frame, make it a keyframe if it isn't - since the movie stops, i expect it to be a keyframe. place a button somewhere - if you just want it to just a click anywhere on the movie kind of button just make a transparent button and make it the movie size. also give your button an instance name.
select the keyframe and NOT the button itself, open the actions panel and type the following:
Code:
buttonname.onRelease = function() {
gotoAndPlay(1);
}
|
|
08-29-2007, 01:00 AM
|
#5
|
Status: Member
Join date: Dec 2006
Location: Torrington, Ct, USA
Expertise:
Software:
Posts: 127
|
i followed your directions but it keeps looping, should i put a stop somewhere
thanks
|
|
08-29-2007, 02:35 AM
|
#6
|
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
Posts: 2,246
|
i'm not sure how you have the file set up, but based on what you said my understanding of it is this:
you want your movie to play automatically and stop when it reaches the end. then, you want the option to replay?
if so, go your last frame add stop(); to the actions panel then follow my previous instructions:
* insert new layer
* on last frame insert keyframe
* add button to key frame
* give button instance name & add button code to actions panel
the other scenario i see is you want it to wait for a click to activate.
if so:
* insert new layer
* add button & code to first frame
* select all frames and drag them over 1 frame
* put stop(); into the actions panel on frame 1 - so now your first animation frame and button are on frame 2
* make the button code point to frame 2 instead of 1. - i avoid using play() because with some of my past experiences triggering actions really fast confused flash and it screwed up the timing.
|
|
08-29-2007, 10:41 AM
|
#7
|
Status: Member
Join date: Dec 2006
Location: Torrington, Ct, USA
Expertise:
Software:
Posts: 127
|
Originally Posted by derek lapp
i'm not sure how you have the file set up, but based on what you said my understanding of it is this:
you want your movie to play automatically and stop when it reaches the end. then, you want the option to replay?
if so, go your last frame add stop(); to the actions panel then follow my previous instructions:
* insert new layer
* on last frame insert keyframe
* add button to key frame
* give button instance name & add button code to actions panel
|
this is what i would like it to do,
i put a stop in the last frame,
now it plays, stops, and the cursor changes to a hand and stays that way, but when i click nothing happens. i have the code from the previouse post, its in the last key frame of the button layer, i have the instance name and the name in the code the same.
thanks
Lisa
|
|
08-29-2007, 01:16 PM
|
#8
|
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
Posts: 2,246
|
where did you place the button code? my first instinct is you might have had the button selected when you entered the code into the actions panel instead of having the frame selected. in that case, the code won't execute but i can't remember if flash gives you a warning when that happens.
i've made a quick test movie to show you what i did.
http://www.vectorthis.com/temp/replay.fla
|
|
08-29-2007, 04:59 PM
|
#9
|
Status: Member
Join date: Dec 2006
Location: Torrington, Ct, USA
Expertise:
Software:
Posts: 127
|
|
|
08-29-2007, 08:03 PM
|
#10
|
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
Posts: 2,246
|
- your put the keyframe on frame 1, so at the end of the movie, there's nothing to execute
- you need a button to trigger the code
- this.onRelease = function(){ this.gotoAndPlay(2); } 'this' refers to the frame. onRelease (and the others) only apply to buttons as you can't press/release a frame. the button (that you didn't make) needs to be released
http://www.vectorthis.com/temp/movie2_works.fla
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|