Movie clip plays onRollover?
When someone rolls over a button, I would like it to play a
movie clip.
I place the movie clip on the rollover state though it is not
working.
1. Am I doing this right?
2. What if I want the movie clip to play somewhere else on
the stage.
How do I position the movie clip while in button edit mode so
it is in
the location I want it to be when it is actually placed on
the stage?
Thanks.
dave wrote:
> When someone rolls over a button, I would like it to
play a movie clip.
> I place the movie clip on the rollover state though it
is not working.
>
> 1. Am I doing this right?
Not really the right way. Tho, You can place movie clip in
over state of the
button but then you have no control over it as the states
reset as soon as you
move the mouse out of the HIT area. You need to place the
clip outside of the
button, give it instance name and target that instance name
using button handlers,
like on roll over or on press.
> 2. What if I want the movie clip to play somewhere else
on the stage.
> How do I position the movie clip while in button edit
mode so it is in
> the location I want it to be when it is actually placed
on the stage?
button with instance name myBtn and movie clip with instance
name myMovie.
On timeline frame following action:
myBtn.onRollover = function(){
myMovie.play();
Best Regards
Urami
"Never play Leap-Frog with a Unicorn."
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami>
Similar Messages
-
How do I make a movie clip play between scenes?
I am VERYnew to flash so please bear with me. I am having a
problem with a movie clip playing between scenes. As scene 1 plays,
the movie works correctly. When I click on my button to go to scene
2 the movie clip starts over. I would like it to continue from
scene 1 seamlessly. Is this possible? How do I do it?avoid scenes - they are only for timeline management inside
flash only - upon export it all becomes
one long timeline - using them can be useful but in many
instances it can cause navigational issues
such as yours. Many developers avoid scenes - the ones who
use them are mostly animators who have
longer timelines with different scenes (actual settings, like
backgrounds and characters).
--> Adobe Certified Expert (ACE)
--> www.mudbubble.com :: www.keyframer.com
-->
http://flashmx2004.com/forums/index.php?
-->
http://www.macromedia.com/devnet/flash/articles/animation_guide.html
-->
http://groups.google.com/advanced_group_search?q=group:*flash*&hl=en&lr=&ie=UTF-8&oe=UTF-8
Maureen Getchell wrote:
> I am VERYnew to flash so please bear with me. I am
having a problem with a
> movie clip playing between scenes. As scene 1 plays, the
movie works correctly.
> When I click on my button to go to scene 2 the movie
clip starts over. I would
> like it to continue from scene 1 seamlessly. Is this
possible? How do I do it?
> -
Making movie clips play in reverse in AS 3.0
Hey all. I'm changing all my files to AS 3.0 because of some
new elements I'd like to use in flash CS4.
Here:
http://www.iaw-atlanta.com/IvyLeague1-13-09.html
I have the menu navigation at the bottom with 4 buttons. When the
buttons are moused over they ascend and when they are moused out
the movie plays in reverse so that they descend. Basically in the
movie clip, I have it stopped as well as gotoAndPlay the next frame
when the button is moused over and then have a script telling it to
reverse when moused out. I know how to do this in AS 2.0 but how
can I translate the script to 3.0?DjPhantasy5,
> Ok thanks, I'll see what he also has to say as well.
Actually, NedWebs pretty much nailed it. :) The approach
you've taken
is an interesting one, because it scales all the way back to
Flash Player 5,
which didn't yet support the MovieClip.onEnterFrame event.
Without that
event, you need something like your "controller" symbol -- a
separate
looping timeline -- to perform code that depends on frame
loops.
Available as of Flash Player 6, that event would allow you
to
consolidate your code a bit by putting it all in a single
frame and avoiding
the extra movie clip symbol. That doesn't mean your approach
is wrong, by
any stretch. In fact, it's good to know your options, because
if you ever
need to publish to Flash Player 5, you'll probably do best to
use the setup
you've taken.
I'll demonstrate onEnterFrame in just a bit, in case you
want to take a
look at that.
>> there's no _root reference in AS3, but you can use a
>> MovieClip(this.parent) (which replaces what _parent
>> used to do) to locate something outside of the
immediate
>> movieclip.
The term "parent," in this context, is technically a
property of the
MovieClip class, which means all movie clips in AS3 have
access to the
"parent" feature, which points to the timeline that contains
the movie clip
in question. Buttons also feature a "parent" property. In
AS2, this
property acted exactly the same, only it was preceeded by an
underscore.
In fact, NedWebs' suggested code works the same in your
existin file.
Instead of this:
// Your existing code ...
if (_root.animation._currentframe>1) {
_root.animation.prevFrame();
this.gotoAndPlay(2)
if (_root.animation._currentframe<=1) {
this.gotoAndStop(1);
... you could be using this:
// Alternative code ...
if (_parent.animation._currentframe>1) {
_parent.animation.prevFrame();
gotoAndPlay(2)
if (_parent.animation._currentframe<=1) {
gotoAndStop(1);
... because from this scope -- that is, from this point of
view -- the
MovieClip._parent property points to the same timeline that
_root does.
That changes, of course, based on how deeply nested the
current scope is.
The term "this" in the above code is optional, because Flash
understands
what scope you're in. From the point of view of this code,
_parent is
understood to refer to the current scope's parent timeline,
just like
gotoAndPlay() is understood to refer to the current scope's
own timeline.
You could precede either of those by "this" or not.
Many people will argue that _root is probably best avoided,
only because
it's a slippery slope. It doesn't always refer to the main
timeline you
think it does, depending on whether or not your SWF is loaded
into another
SWF at runtime. Meanwhile, _parent *always* refers to the
immediately
parent timeline.
So when you look at it that way, this perfectly valid AS2:
if (_parent.animation._currentframe>1) {
... isn't much different at all from its AS3 counterpart:
if (MovieClip(parent).animation.currentFrame>1) {
It would be nicer if you didn't need to cast the parent
reference as a
movie clip here, but if you don't, AS3 doesn't realize that
the scope in
question is a movie clip.
>> You can string them along as...
>> MovieClip(this.parent.parent)
Exactly.
>> Your _currentframe in the the controller becomes
>> currentFrame. That's about it. The rest of what I
>> saw will fly as is.
Not quite. AS3 doesn't support the on() or onClipEvent()
functions, so
you won't be able to attach your code direction to the
button. Instead,
you'll have to put it in a keyframe -- which you can also do
with AS2. It's
a good idea, in any case, because it allows you to put all
your code in one
place, making it easier to find.
Here's a quick note on direct attachment:
http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent
To convert your existing FLA structure to AS3, you might,
for example,
do this:
animation.buttonMode = true;
animation.addEventListener(MouseEvent.ROLL_OUT, outHandler);
animation.addEventListener(MouseEvent.ROLL_OVER,
overHandler);
function outHandler(evt:MouseEvent):void {
controller.gotoAndPlay(2);
function overHandler(evt:MouseEvent):void {
controller.gotoAndPlay(4);
That takes care of the on(rollout) and on(rollover) code in
your current
version. The first line (buttonMode) is only necessary
because I got rid of
the button symbol and, instead, associated the event handlers
directly with
your animation clip. (Movie clips handle button-style events,
too, so you
don't need the button.) In AS3, event handling is very
straightforward:
you reference the object (here, animation), invoke its
inherited
addEventListener() method, then pass in two parameters: a)
the event to
listen for, and b) the function to perform when that event
occurs.
You can see that spelled out above. In AS2, there are quite
a few ways
to handle events, including on()/onClipEvent(), so it's
harder to know when
to use what approach. For buttons and movie clips, the
princple works the
same as I just showed, but the syntax is different.
Let's take a quick look at reducing all this code by using
the
onEnterFrame event. First, check out this AS2 version:
animation.onRollOut = outHandler;
animation.onRollOver = overHandler;
function outHandler():Void {
this.onEnterFrame = reversePlay;
function overHandler():Void {
this.onEnterFrame = null;
this.play();
function reversePlay():Void {
this.prevFrame();
All of that code would appear in frame 1. You don't need the
controller
movie clip. The animation clip no longer contains an orb
button, because
we're using animation itself as the "button". (You can always
see what
functionality any object has by looking up its class. If
you're dealing
with a movie clip, look up the MovieClip class. See the
Properties heading
to find out what characteristics the object has, see Methods
to find out
what the object can do, and see Events to find out what the
object can react
to.)
In the above code, it's all laid out pretty easily. This is
AS2,
remember. We have two events we're listening for:
MovieClip.onRollOut and
MovieClip.onRollOver. Those events are established for the
animation movie
clip by way of its instance name, and associated with
corresponding custom
functions. The outHandler() function associates yet another
function to the
MovieClip.onEnterFrame event of the animation clip. Very
simply, it
instructs animation to perform the custom reversePlay()
function every time
it encounters an onEnterFrame event. The overHandler()
function kills that
association by nulling it out, and telling animation to play,
via the
MovieClip.play() method. Finally, the reversePlay() function
simply invokes
MovieClip.prevFrame() on the animation clip.
Here's the AS3 version:
animation.buttonMode = true;
animation.addEventListener(MouseEvent.ROLL_OUT, outHandler);
animation.addEventListener(MouseEvent.ROLL_OVER,
overHandler);
function outHandler(evt:MouseEvent):void {
animation.addEventListener(Event.ENTER_FRAME, reversePlay);
function overHandler(evt:MouseEvent):void {
animation.removeEventListener(Event.ENTER_FRAME,
reversePlay);
animation.play();
function reversePlay(evt:Event):void {
evt.target.prevFrame();
It looks wordier, but if you look carefully, you'll see that
it's
essentially the same thing. The main difference is the way
scope works in
AS3. In AS2, there are numerous references to "this", because
the event
handler functions operate in the same scope as the object to
which the
association is made. In AS3, the references aren't to "this",
but rather to
the same animation clip by its *intance name*, because in
AS3, the scope
operates in the same timeline in which the code appears
(namely, in this
case, the main timeline).
In the reversePlay() function, in order to emulate a "this"
sort of
setup, I'm referring to the parameter that gets passed to all
event handler
functions in AS3. I happened to name it "evt" (for event),
but you can call
it what you like. In the case of reversePlay(), the evt
parameter refers to
an instance of the Event class, which has a target property.
The target
property refers to the object that dispatched the event --
happens to be
animation, in this case. So evt.target, in this context,
refers to
animation, which is what I invoke the MovieClip.prevFrame()
method on.
I've uploaded a handful of FLA files to my server. I won't
keep them
there forever ... maybe a couple weeks, as of this post:
http://www.quip.net/RewindTestAS3.fla
http://www.quip.net/RewindTestAS3_new.fla
http://www.quip.net/RewindTestAS2_new.fla
David Stiller
Co-author, ActionScript 3.0 Quick Reference Guide
http://tinyurl.com/2s28a5
"Luck is the residue of good design." -
Making a movie clip play beyond keyframe
Hi,
I have a movie clip that is about 30 frames long. I've placed an instance of it on the main timeline and it follows a motion path. My motion path ends after about 20 frames. At this time, I've inserted a keyframe which is preventing my movie clip from playing the remaining 10 frames.
I tried adding an ActionScript layer where the last keyframe is and it reads:
instance.gotoAndPlay (20)
Doesn't seem to work. Just a note that this is around frame 292 of the main timeline. Also note, a new keyframe begins on another layer with a different movie clip.
Any ideas? Much appreciated.I think I may understand now, and your first approach to solving it should work. What you need to be sure to do is to assign the instance name at every keyframe. If you did not name it in its first frame of the main timeline, it will inherit that lack of a name in the keyframe at the end of the tween, regardless of your assigning it there... just a quirk of Flash.
Another option, if this is a straight line tween of the object on the main timeline is to use actionscript to animate it rather than a timeline tween. -
Hi guys,
I have a problem with my loaded movie clip, its playing very fast than its suppose to, (using loadMovie) I've tried to adjust the frame rate of the main file and the movie file, but still the problem occurs.... any suggestion on fixing this??If both movies do not have the same frame rate, then they need to be the same.
-
How do you make a movie clip play in CS4
Hello, I used Flash MX a long time ago (beginner level) then
left it for years. I'm now using CS4 and am stuck. I have a stage
with a movie clip placed onto it. I want to create a simple 'click
to play' button so that the movie clip only plays on click of this
button. Can someone please give me a step by step (idiot-proof)
guide on how to do this pleaseCases that use to be _property in AS2 are now just property
in AS3. So _x is x, _y is y, and _visible is visible. This should
work:
function showPlay(event:MouseEvent):void
play_text.visible = true;
pause_text.visible = false; -
Controlling movie clip play order
Good Day,
I have a web site that opens with two movie clips. One (A)
folds open some navigation menus, the other (B) opens some
rectangles that hold content. I want "A" to play out then, once it
is played, I want "B' to start. It sounds simple but I cannot get
the right code. I need something I can use for other applications
in other pages. I have this code so far; (naigation_mc = "A"
page01_mc = "B")
if (navigation_mc.play=true) {
page01_mc.gotoAndStop("start");
} else {
page01_mc.gotoAndPlay("start");
Perhaps there needs to be more code to controll this?The most likely cause for you problem lies in the scope of
"this" in your case.
While traitional flash5 style buttons would have the imeline
in which they reside (e. g. the main timeline) as scope and a
comand like
on (release){
stop();
wouls stop he playhead of the main timeline.
Where as the more modern form of attaching code to a button
and the explicit use of
this handles buttons like movieClips so that a command like:
myButton.onRelease = function(){
this.stop();
will try to stop the buttons (= movieclips) own timeline.
I hope that helps
[This fact isn't stated clearly in the docs, but I at least
asked Macromedia (back then) to add it at least to the live
docs.] -
Dear all
I have a singl movie clip which has an embedded video inside.
I use the following actionscript commands to stop and play it
onClipEvent(load) {
stop();
onClipEvent(mouseDown) {
play(); }
onClipEvent(mouseUp) {
stop(); }
The problem I face is that the movie clip should play when
clicked by mouse ONLY on movie clip area which occupies only a
small part of the stage. However, when I click the mouse ANYWHERE
on the stage the movie starts to play.
Any hint? Do I need to control the coordinates of the mouse ?
Thanks
Hagopsorry, I made a mistake- i had not re-saved my files, so it
worked but not the way i thought...
my code, based on your response is attached- however it
doesnt work...
mcOther is a mc within the "child" - other.swf.
this code needs to be in the "parent" swf...
thank you. -
Movie clip plays then stops will not start
I downloaded this clip from the internet. It plays fine(HD) then it stops. I can advance fram by fram only.
please help.First try to restart without extentions to see if you can just copy manually the informations onto a disk or extern HD.
If this won't help you can try DATA rescue II . You may be able to get a part of your docs back, but this can take a while... between a day and a month... -
Playing a movie clip in a simgle frame
I'm making a flash gallery of several different animations,
each being in one movie clip. I was wondering if there's a way to
make a whole, say, 1000 frame movie clip play in a single frame on
the main timelime, and how it would be done. (assuming that the
main timeline frame has the actionscript to make the movie stop)
I'm kinda new to actionscript and all, even though I've been
working with flash for a while, so it would be a real big help for
this project and future ones.
-EDIT-
I'm using AS2 for this project.It helps to realize that even the main timeline is a
MovieClip instance.
MovieClips play independently of one another, and can be
nested. So if you
just take your 1000 frame clip and place it on a frame (any
frame will do)
it will play - so long as the play head of the parent clip is
on that frame.
And you said you have a stop(); on the main timeline, so I
assume it is. So,
like kglad said, just put the clip on stage...
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
running Windows XP 3 newish computer with lots of memory and hard drive space. Used to be fine, could play any clip or movie then suddenly about 6 months ago it started crashing when any movie clip played. I believe its an update in Firefox that caused the problem as it started happening after an UPDATE automatically loaded. Have been trying to resolve but noone I ask for help from responds including Mozilla.
running Windows XP 3 newish computer with lots of memory and hard drive space. Used to be fine, could play any clip or movie then suddenly about 6 months ago it started crashing when any movie clip played. I believe its an update in Firefox that caused the problem as it started happening after an UPDATE automatically loaded. Have been trying to resolve but noone I ask for help from responds including Mozilla.
-
AS3 to make movie clip not play on default?
I created a movie clip that I want to play when a button is
clicked and
stop when another button is clicked.
I have a stop action on the first frame where the 2 buttons
appear and
the movie clips resides. When I test the movie, the movie
clip plays by
default.
How do I set it up so the movie clip does not play until the
user clicks
the play button?
The code I am using:
myPlay_btn.addEventListener(MouseEvent.CLICK, playMc);
myStop_btn.addEventListener(MouseEvent.CLICK, stopMc);
function playMc(e:MouseEvent):void{
my_mc.play();
function stopMc(e:MouseEvent):void{
my_mc.stop();
Thanks!!!Not sure if I understand. Where specifically should this be
added to the
code:
myPlay_btn.addEventListener(MouseEvent.CLICK, playMc);
myStop_btn.addEventListener(MouseEvent.CLICK, stopMc);
function playMc(e:MouseEvent):void{
my_mc.play();
function stopMc(e:MouseEvent):void{
my_mc.stop();
Thanks! -
Can't get nested movie clip to play
Hi everyone,
I have a movieclip on one of the frames on the maintimeline.
Within this movieclip is a nested movieclip which itself is
contained by another clip. The first movie clip plays to a certain
frame where I've got some code telling the nested movie clip to
play at that frame but this nested clip doesn't play. I'm not sure
if I'm targetting the nested clip incorrectly or whether something
else is wrong with the code.
The .fla file can be downloaded at:
http://www.officelinkonline.com.au/Ad/
if someone would take a look. The movie clip in question is
on the layer called text5, and within this mc on frame 15 is the
code I'm trying to use to get the nested movieclip to play at that
point. The code used on that frame is:
this.innerText5_mc.free_mc.play();
stop();
pauseAnim = setInterval (this, "nextFrame", 4000);
I wondered if someone could take a look and see what I might
be doing wrong? Basically the free_mc clip just makes the word
"FREE" scale up.
Would really appreciated any advice.
ThanksThanks again. I'm a bit worried that you weren't able to see
the font that I used. All of the text used in the animations are
static text fields. I don't seem to have the option to embed these
characters since it's static text. It'll only let me embed if the
text fields are dynamic. Does this mean I have to change them all
to dynamic text fields, and if so do I need to embed the font in
every text field in every frame of the animation or can you do this
in one place?
Appreciate your continued help. -
I have a scene with 7 frames on the main stage, each
containing movie clips, i was wondering if there was a way to:
1. Make one or part of one of these movie clips play
backwards when a button is pressed.
2. Once a movie ends another specified clip(not neceserally
after it in the timeline) automatically plays.
Thanks,
BenHi,
Ive emailed you the file. Any problems then let me know.
Cheers -
Flash Newbie needs help with Movie Clips/Action Scripting
Hi -
I'm having a problem with my movie clips playing
simultaneously and cannot, for the life of me, figure out what I
have done wrong. I'm new to flash, so I may have set something up
incorrectly, but here's what I have so far:
11 layers, total: 1 layer with 10 control buttons, each
button with the following actionscript:
on (release) {
gotoAndPlay(85);
Where the number changes in relation to which keyframe the
next movie is on.
I have 10 movies, total, but they are only movie clips,
essentially photo slide shows with audio, made all in the library.
The problem happens when I click on the second or third
button. Not only does the movie that I have selected begin to play,
but all of the previous clips do as well, so it all sounds quite
garbled. I don't know what I am missing in the action script, as my
Action Layer has a stop command on it at each keyframe where there
is a new clip to play.
I have tried to add a stopAllSounds command, but I'm afraid
that doesn't do anything because it is not a "sound file" per se,
playing in the timeline.
I'm at the end of my rope and really need some help in
figuring this one out. My project is hanging in the balance on
this, as I have scripted everything else correctly and it runs
beautifully.
Please help!
Thanks,
CarolineEach layer has a blank keyframe before and after each
movieclip. Each movie clip is at a different frame. Even with the
blank keyframes added, the second video starts to play and then the
first video begins to play. Same happens if I click on the third
button. Third plays, and starts 1st and 2nd shortly thereafter. Is
there an action script I can put in that will tell the timeline
that, when a button is clicked, no matter where the movieclip is,
it will stop and start the newly selected movieclip?
Maybe you are looking for
-
Using BAPI_ACTIVITYCRM_CREATEMULTI for creating sales order in CRM
Hello Experts, I am creating a sales order using BAPI_ACTIVITYCRM_CREATEMULTI, But I am getting the following errors: 1. Reference Object Type (ORGMAN) not allowed 2. Reference Object Type (PARTNER) not allowed 3. Incomplete interface data - No refer
-
Photoshop Elements 10 - Installation Query
I have 3 disks to install, however when I insert 2nd disk and use the same serial number as used for disk 1, it says invalid. I'm operating with Windows 7. Any suggestions?? Cheers
-
Hi, We have lots of experience creating images and software UIs but are new to video editing so apologies in advance if this turns out to be a noob question, We have seached this forum, other forums and google but have not found the answer yet so I h
-
SAP BI4.0 upgrade right software
Hi - We are planning to upgrade from BO3.1 to BI4.0. I've downloaded the installation software from SAP download center. The version it is showing is SAP BI4.0 SP02 (support pack 02). Is this the right version to start the full deployment or I need t
-
Alternate line background color
Hi All - In CR2008, how would I go about making it so each line of a report alternates background color? So say, odd rows have a background of gray and even rows have a background of white? Thanks!