Using Events To Play Another Movie Clip
Dear Readers:
I have a set of buttons in my flash movie that, when a mouse
cursor passes over it, another movie clip on the stage causes a
layer with text to gradually appear from below. It pops up, so to
speak, and eventually stops, displaying the text related to the
button in full view.
Passing over a different button causes the text layer to move
downward, slowly disappear off the stage, then reappear in the same
manner with text associated with that latest button. Its fairly
simple and works fine, as long as the user waits patiently for the
text layer to scroll down and back up before passing over another
button. See code below.
However, if the user decides to quickly pass over multiple
buttons (before the text layer reaches the top), the event handler
is coded such that if the mouseover event occurs BEFORE the text
layer reaches the top, the text layer starts over at the bottom, so
the transition is not smooth. Imagine the text layer just about to
reach the top, when the mouseover event occurs, now the text layer
starts over from the bottom. Very choppy.
I'd like to grab the current frame of the text layer movie
clip when the mouseover event occurs, and have the layer move back
down from there, reach the bottom, then come back up, rather than
starting from the bottom. Any help in coming would be great. Thanks
in advance.
yourI = setInterval(f,t) starts a loop. it repeatedly calls
the function f() every t milliseconds until a clearInterval(yourI)
is executed.
the most common problem that occurs with setInterval() is
executing it twice (or more) with no intervening clearInterval().
when that happens all hell breaks loose and the swf will call the
function much more rapidly than intended and can not be (easily)
stopped no matter how many clearInterval() statements you try and
execute.
the easiest way to prevent that problem is to execute a
clearInterval() just BEFORE all setInterval() statements. it
doesn't hurt anything to (try and) clear and interval that doesn't
exist and occasionally it'll stop the seemingly bizarre problems
that occur with out-of-control intervals:
clearInterval(yourI);
yourI=setInterval(f,t);
Similar Messages
-
How to stop a slideshow and show another movie clip at the end?
Currently my slideshow is in a loop. At the end of last slideshow, I want to show another movie clip (End_mv) that's on another layer. How do I do that? My current scripts are below:
import fl.transitions.Tween;
import fl.transitions.easing.*;
//change scale on an image
var fadeTween:Tween;
//To slide in on X axis
var slideXTween:Tween;
//To slide in on Y axis
var slideYTween:Tween;
//To fade IN
var alphaTween:Tween;
//To get bigger on its X axis
var scaleXTween:Tween;
//To get bigger on its Y axis
var scaleYTween:Tween;
//var fadeTween:Tween;
//description place holder
var strDescrp:String;
//source place holder
var strSource:String;
//x poistion
var posX:Number;
//y position
var posY:Number;
//degree rotation
var degreeRot:Number;
// delay between slides
//const TIMER_DELAY:int = 5000;
var TIMER_DELAY:int = 5000;
// fade time between slides
const FADE_TIME:int = 3;
// reference to the current slider container
var currentContainer:Sprite;
// index of the current slide
var intCurrentSlide:int = -1;
// total slides
var intSlideCount:int;
// timer for switching slides
var slideTimer:Timer;
// slides holder
var sprContainer1:Sprite;
var sprContainer2:Sprite;
// slides loader
var slideLoader:Loader;
// url to slideshow xml
var strXMLPath:String = "lstHouse.xml";
// slideshow xml loader
var xmlLoader:URLLoader;
// slideshow xml
var xmlSlideshow:XML;
var txtField:TextField = new TextField();
var formatText:TextFormat = new TextFormat();
//start of sound section is for sound
var soundReq:URLRequest = new URLRequest("PaukenBrumfiel_AngelsOnHigh.mp3");
var sound:Sound = new Sound();
sound.load(soundReq);
sound.addEventListener(Event.COMPLETE, onComplete);
//end of sound section
function onComplete(event:Event):void
sound.play();
function init():void
// create new urlloader for xml file
xmlLoader = new URLLoader();
// add listener for complete event
xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete);
// load xml file
xmlLoader.load(new URLRequest(strXMLPath));
// create new timer with delay from constant
slideTimer = new Timer(TIMER_DELAY);
// add event listener for timer event
slideTimer.addEventListener(TimerEvent.TIMER, switchSlide);
// create 2 container sprite which will hold the slides and
// add them to the masked movieclip
sprContainer1 = new Sprite();
sprContainer2 = new Sprite();
mcSlideHolder.addChild(sprContainer1);
mcSlideHolder.addChild(sprContainer2);
// keep a reference of the container which is currently
// in the front
currentContainer = sprContainer2;
function onXMLLoadComplete(event:Event):void
// create new xml with the received data
xmlSlideshow = new XML(event.target.data);
// get total slide count
intSlideCount = xmlSlideshow..image.length();
// switch the first slide without a delay
switchSlide(null);
function fadeSlideIn(e:Event):void {
// add loaded slide from slide loader to the
// current container
currentContainer.addChild(slideLoader.content);
// clear preloader text
//mcInfo.lbl_loading.text = "";
// fade the current container in and start the slide timer
// when the tween is finished
//Tweener.addTween(currentContainer, {alpha:1, time:FADE_TIME, onComplete:function() { slideTimer.start(); }});
//strSource = xmlSlideshow.image[intCurrentSlide].@src;
fadeTween = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
//scale = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
slideTimer.start()
onComplete:function();
function switchSlide(e:Event):void
// check, if the timer is running (needed for the
// very first switch of the slide)
if(slideTimer.running)
slideTimer.stop();
// check if we have any slides left and increment
// current slide index
if(intCurrentSlide + 1 < intSlideCount)
intCurrentSlide++;
// if not, start slideshow from beginning
else
intCurrentSlide = 0;
// check which container is currently in the front and
// assign currentContainer to the one that's in the back with
// the old slide
if(currentContainer == sprContainer2)
currentContainer = sprContainer1;
else
currentContainer = sprContainer2;
// hide the old slide
currentContainer.alpha = 0;
// bring the old slide to the front
mcSlideHolder.swapChildren(sprContainer2, sprContainer1);
strDescrp = xmlSlideshow.image[intCurrentSlide].@desc;
//strSource = xmlSlideshow.image[intCurrentSlide].@src;
//txtField.border = true;
//txtField.x = 0;
//txtField.y = 600;
txtField.width = 855;
txtField.height = 200;
//txtField.background = true;
//txtField.backgroundColor = 0xEE9A00;
txtField.alpha = 20;
txtField.text = strDescrp;
formatText.align = TextFormatAlign.CENTER;
//txtField.autoSize = TextFieldAutoSize.LEFT;
formatText.color = 0x000;
formatText.size = 30;
txtField.x = 0;
txtField.y = 550;
posX = 0;
posY = 0;
degreeRot = 0;
// create a new loader for the slide
slideLoader = new Loader();
// add event listener when slide is loaded
slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeSlideIn);
// load the next slide
slideLoader.load(new URLRequest(xmlSlideshow.image[intCurrentSlide].@src));
addChild(txtField);
txtField.setTextFormat(formatText)
// init slideshow
init();I got this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/swapChildren()
at University_Advancement_Holiday_Greeting2012_fla::MainTimeline/switchSlide()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
And here's the code:
// import tweener
//import caurina.transitions.Tweener;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
//change scale on an image
var fadeTween:Tween;
//To slide in on X axis
var slideXTween:Tween;
//To slide in on Y axis
var slideYTween:Tween;
//To fade IN
var alphaTween:Tween;
//To get bigger on its X axis
var scaleXTween:Tween;
//To get bigger on its Y axis
var scaleYTween:Tween;
//var fadeTween:Tween;
//description place holder
var strDescrp:String;
//source place holder
var strSource:String;
//x poistion
var posX:Number;
//y position
var posY:Number;
//degree rotation
var degreeRot:Number;
// delay between slides
//const TIMER_DELAY:int = 5000;
var TIMER_DELAY:int = 5000;
// fade time between slides
const FADE_TIME:int = 3;
// reference to the current slider container
var currentContainer:Sprite;
// index of the current slide
var intCurrentSlide:int = -1;
// total slides
var intSlideCount:int;
// timer for switching slides
var slideTimer:Timer;
// slides holder
var sprContainer1:Sprite;
var sprContainer2:Sprite;
// slides loader
var slideLoader:Loader;
// url to slideshow xml
var strXMLPath:String = "lstHouse.xml";
// slideshow xml loader
var xmlLoader:URLLoader;
// slideshow xml
var xmlSlideshow:XML;
var txtField:TextField = new TextField();
var formatText:TextFormat = new TextFormat();
//var myEnding:MovieClip = stage.getChildByName('End_mc') as MovieClip;
//start of sound section is for sound
var soundReq:URLRequest = new URLRequest("PaukenBrumfiel_AngelsOnHigh.mp3");
var sound:Sound = new Sound();
sound.load(soundReq);
sound.addEventListener(Event.COMPLETE, onComplete);
//end of sound section
function onComplete(event:Event):void
sound.play();
function init():void
//reference my movie clip "End_mc" oon the stage and turn its visibility off
MovieClip(getChildByName('End_mc')).visible = false;
// create new urlloader for xml file
xmlLoader = new URLLoader();
// add listener for complete event
xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete);
// load xml file
xmlLoader.load(new URLRequest(strXMLPath));
// create new timer with delay from constant
slideTimer = new Timer(TIMER_DELAY);
// add event listener for timer event
slideTimer.addEventListener(TimerEvent.TIMER, switchSlide);
// create 2 container sprite which will hold the slides and
// add them to the masked movieclip
sprContainer1 = new Sprite();
sprContainer2 = new Sprite();
mcSlideHolder.addChild(sprContainer1);
mcSlideHolder.addChild(sprContainer2);
// keep a reference of the container which is currently
// in the front
currentContainer = sprContainer2;
//function onXMLLoadComplete(e:Event):void
function onXMLLoadComplete(event:Event):void
// create new xml with the received data
xmlSlideshow = new XML(event.target.data);
// get total slide count
intSlideCount = xmlSlideshow..image.length();
// switch the first slide without a delay
switchSlide(null);
function fadeSlideIn(e:Event):void {
// add loaded slide from slide loader to the
// current container
currentContainer.addChild(slideLoader.content);
// clear preloader text
//mcInfo.lbl_loading.text = "";
// fade the current container in and start the slide timer
// when the tween is finished
//Tweener.addTween(currentContainer, {alpha:1, time:FADE_TIME, onComplete:function() { slideTimer.start(); }});
//strSource = xmlSlideshow.image[intCurrentSlide].@src;
fadeTween = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
//scale = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
slideTimer.start()
onComplete:function();
function switchSlide(e:Event):void
// check, if the timer is running (needed for the
// very first switch of the slide)
if(slideTimer.running)
slideTimer.stop();
// ADDED: Check if using sprContainer2 and at the last slide
//if ((currentContainer == sprContainer2) && (intCurrentSlide == intSlideCount))
trace("Current Slide: " + intCurrentSlide);
trace("SlideCount: " + intSlideCount);
if ((currentContainer == sprContainer2) && ((intCurrentSlide + 1) == intSlideCount))
// hide the slideshow (and other related elements, or remove them if desired)
//mcSlideHolder.visible = false;
// remove any clips directly inside slideshow (any timers/etc need to be stopped too)
while (mcSlideHolder.numChildren > 0)
mcSlideHolder.removeChildAt(0);
// I do see a var named 'sound' playing so you might want to:
//sound.stop();
//sound = null;
// etc any other slideshow-only elements to hide/remove..
// play your movie
MovieClip(getChildByName('End_mc')).visible = true;
MovieClip(getChildByName('End_mc')).play();
// check if we have any slides left and increment
// current slide index
if(intCurrentSlide + 1 < intSlideCount)
intCurrentSlide++;
// if not, start slideshow from beginning
else
intCurrentSlide = 0;
// check which container is currently in the front and
// assign currentContainer to the one that's in the back with
// the old slide
if(currentContainer == sprContainer2)
currentContainer = sprContainer1;
else
currentContainer = sprContainer2;
// hide the old slide
currentContainer.alpha = 0;
// bring the old slide to the front
mcSlideHolder.swapChildren(sprContainer2, sprContainer1);
strDescrp = xmlSlideshow.image[intCurrentSlide].@desc;
//strSource = xmlSlideshow.image[intCurrentSlide].@src;
//txtField.border = true;
//txtField.x = 0;
//txtField.y = 600;
txtField.width = 855;
txtField.height = 200;
//txtField.background = true;
//txtField.backgroundColor = 0xEE9A00;
txtField.alpha = 20;
txtField.text = strDescrp;
formatText.align = TextFormatAlign.CENTER;
//txtField.autoSize = TextFieldAutoSize.LEFT;
formatText.color = 0x000;
formatText.size = 30;
txtField.x = 0;
txtField.y = 550;
posX = 0;
posY = 0;
degreeRot = 0;
// create a new loader for the slide
slideLoader = new Loader();
// add event listener when slide is loaded
slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeSlideIn);
// add event listener for the progress
//slideLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
// load the next slide
slideLoader.load(new URLRequest(xmlSlideshow.image[intCurrentSlide].@src));
addChild(txtField);
txtField.setTextFormat(formatText)
// init slideshow
init(); -
Playing a Movie Clip within a Movie Clip on load
Hi,
I'm trying to play a Movie Clip animation that is within a Movie Clip after a button has been pressed in a different Movie Clip.
The issue is that all Movie Clip animations are playing as soon as the SWF is loaded.
I have a separate Main.as file that contains all of the coding except for the animation stops:
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip
var title1:Title1;
var scene1:Scene1;
var scene2:Scene2;
var scene3:Scene3;
var scene4:Scene4;
var scene5:Scene5;
var scene6:Scene6;
var scene7:Scene7;
var scene8:Scene8;
var scene9:Scene9;
var scene10:Scene10;
public function Main()
title1 = new Title1();
scene1 = new Scene1();
scene2 = new Scene2();
scene3 = new Scene3();
scene4 = new Scene4();
scene5 = new Scene5();
scene6 = new Scene6();
scene7 = new Scene7();
scene8 = new Scene8();
scene9 = new Scene9();
scene10 = new Scene10();
addChild(title1);
title1.buttonStart.addEventListener(MouseEvent.CLICK,onButtonStartClick);
scene1.buttonWalkOutside.addEventListener(MouseEvent.CLICK,onButtonWalkOutsideC lick);
//title
function onButtonStartClick(event:MouseEvent):void
addChild(scene1);
removeChild(title1);
Scene1(parent).gotoAndPlay("frame1")
//scene1
function onButtonWalkOutsideClick(event:MouseEvent):void
addChild(scene2);
removeChild(scene1);
So right now, I'm getting this error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Stage@46534041 to Scene1.
at Main/onButtonStartClick()
Any help is greatly appreciated... I've been grinding at this all night.I had been trying a bunch of different methods after searching for clues on Google, so it probably doesn't make sense with the parent.
I replaced the code with what you wrote, and I am given this error now:
Main.as, Line 44
1120: Access of undefined property scene1Text1.
Is there somewhere I have to declare scene1Text1 in Main.as? -
Playing different Movie Clips onRollover?
I have several buttons that I would like to play different
movie clips
onrollover on the stage. So if button 1 is rolled over it
plays a clip
in the lower right corner and when rolled off it stops and if
button 2
is rolled over it does the same.
How is this done?
Thanks!This is the code I am currently using to play and stop a
movieclip:
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();
1. How do I drag my movie clips onto the stage, but not have
them
display until the button is rolled over?
2. Would this code just be applied for each button and
modified from
CLICK to OnRollover?
Thanks!!!!
kglad wrote:
> assign a rollover listener to button 1 and in its
listener function apply the play() method to your right corner
movieclip. likewise for button 2. -
Having a loaded movie clip talk to another movie clip
Here's what I want to do:
Load a clip into my main movie - "loadedMovie"
at the end of the timeline in "loadedMovie" i want a
function, perhaps setColor, which will change the colour of another
movie clip which sits in the main movie.
Does this make sense? for a loaded movie clip to change the
color of an instance of another movie?
Many thanks,
Rayponch wrote:
> Here's what I want to do:
>
> Load a clip into my main movie - "loadedMovie"
>
> at the end of the timeline in "loadedMovie" i want a
function, perhaps
> setColor, which will change the colour of another movie
clip which sits in the
> main movie.
>
> Does this make sense? for a loaded movie clip to change
the color of an
> instance of another movie?
Sure make sense.
If the clip you like to target is on main timeline of the
movie than
you will use something like :
on (release) {
var my_color:Color = new Color(_root.SomeMC);
my_color.setRGB(0xFF00FF);
You can also refer to it by level:
(_level123.SomeMC);
Best Regards
Urami
!!!!!!! Merry Christmas !!!!!!!
Happy New Year
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
How to use common event handler for selected movie clips?
I have a 50-state map in a flash movie. Each state is a movie
clip.
Goal: when mouse moves over a state or is clicked in a state,
the state will be highlighted in a bright color and a small box
will pop up near the state and display some information about the
state.
Question: I know I can add mouse event handler for each state
movie clip. But this is simply not good since this has to be done
50 times and codes thus scattered different places. Ideally, I only
want to have one script that determines where the mouse position is
when events trigged and then do right things (highlight the state
and display info. in a pop-up). How can this be implemented?
Thanks!There are a number of ways. Which way is best depends on how
you have things set up so far.
E.g. If they have an enumerable naming convention:
e.g. each clip is like state_0 , state_1 etc.
Then you can loop through them and assign them all to the
same mouse event handler via the loop. You would need properties
other than the name of the clip to identify the state. E.g. each
clip could contain its own data or the index could be a pointer to
the state data (objects with state name and info properties) in a
separate array.
//state clips named
for (var i=0;i<50;i++) {
this["state_"+i].stateindex=i;
this["state_"+i].onPress= statePressHandler;
var stateData:Array = [{name:"StateName,info:"this state
Info"}, name:"StateName,info:"this state Info"}, etc...]
function statePressHandler() {
trace(this);
trace(stateData[this.stateindex].name+"="+stateData[this.stateindex].info);
Other ways are possible too but the best approach depends on
how you have named the clips and whether you're creating them with
code or whether they're already on stage from authoring (my guess).
If they're already on stage and they're called "Alaska" etc, then I
would be inclined to put them all inside a container clip that
contains nothing else other than states. It would avoid the need
for an array of clip names or for checking some other specific
property of each clip to determine if its a 'state' clip and not
something else in a for..in loop. -
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/ -
Play internal movie clip at target
This seems fairly simple, but i can't get it to work.
I want to play a movieclip from the library when a button is
clicked. But the LoadMovie is for SWF. The only way I can get it to
work is have the button click cause - goto frame, which has the
movie clip. But this gets complicated with various clips. Working
in Flash 7-8.
Thank youon the last frame of your movieclip attach:
stop();
this.dispatchEvent(new Event("finished"));
right click your movieclip in the library, click linkage, tick export for actionscript and assign a class (eg, Starmove).
you can then use:
var minTime:uint = 1000;
var maxTime:uint = 3000;
var timer:Timer=new Timer(timeF(),0);
timer.addEventListener(TimerEvent.TIMER,starF);
timer.start();
function starF(e:TimerEvent){
var star:Starmove=new Starmove();
addChild(star);
star.x = Math.floor(Math.random()(stage.stageWidth-star.width)); // these two will probably need adjustment
star.y = Math.floor(Math.random()(stage.stageHeight-star.height)); // ditto
star.addEventListener("finished",removeStarF);
timer.delay = timeF();
function removeStarF(e:Event){
removeChild(e.currentTarget);
e.currentTarget.removeEventListener("finished",removeStarF);
e.currentTarget=null;
function timeF():uint{
return minTime+Math.floor(Math.random()*(maxTime-minTime)); -
Flash CS4 Link to a Movie Clip from inside another Movie Clip
I am working on a Flash CS4 project which has 5 buttons with 5 corresponding movie clips all on the main timeline. Everything in functional so far.
My problem is this: I want to be able to mouse click on a particular word in the text inside movie clip 4 ("mc4") and have it link to movie clip 3 ("mc3") (on the main timeline).
I've tried many things, and I can't get it working.
I have tried to highlight the word then link it to "mc3" in the properties panel where it says link (I successfully linked to an email address and to an outside website in other parts of the project)....
I tried to link it in the properties panel to "mc3", I tried & "parent.mc3", "root.mc3";
Linking it this ways seems to be the simplest, logical thing to do, but I don't know what kind of prefix it needs.
Then, I tried making the word (inside mc4) an invisible button (button6) then linking it to the mc3, with it's actionscript in the main timeline with the other button functions.
I tried duplicating mc3 and duplicating invisible button 3 and moving it's hotspot to over the word.
I tried putting a copy of mc3 and the button inside mc4, with the actionscript also inside mc4.
I tried duplicating mc3 and calling it mc6, and putting that inside mc4, with the actions back on the main timeline, and tried again with the actions inside mc4.
I tried with mc6 and invisible button 6 on the main timeline, but that doesn't seem possible.
I tried using this code from Adobe Actionscript 3.0:
button6.addEventListener(MouseEvent.CLICK, startMovie);
function startMovie(e:MouseEvent):void
this.play("mc6"); [and I also tried with "mc3"]
Nothing works!! Please, I would appreciate any suggestions!!
Thanks,
SuzanneIf I limit my attention to the second sentence of your posting, then I suggest the following (borrowing from the rest of your posting)...
If that invisible button6 is inside MC3 (on MC3's main timeline), atop the word you are trying to link to the movieclip, and you just want to make mc4 play by clicking that invisible button6, then assign the following code to the button6 inside MC3...
button6.addEventListener(MouseEvent.CLICK, startMovie);
function startMovie(e:MouseEvent):void
MovieClip(this.parent).MC4.play();
If I missed, then I missed following your explanation. -
Play a Movie Clip on a frame In Main SWF from a button, within 2 MovieClips
I’m using AS2, Flash 8
I have a frame on my main Timeline Called “Gallery” within this frame I have 2 movie clips, which I need to work together:
One is called:
Gall_Lge_1
Which contains 37 frames.
Each frame has a different movie – basically 37 different photos which pop up on each frame.
(MC’s named Lge_1, Lge_2, Lge_3 etc)
The second Movie Clip I have on here is called:
gall_strip_mc
Which contains a movie clip called strip1 , (which is set to scroll its contents controlled by buttons on ”Gallery”- which works) inside that is a movie clip called strip_all , and contains one frame with 37 buttons/photo thumbnails, (Buttons named btn1, btn2, btn3 etc which I require to link each individual button to the corresponding photo/frame in Gall_Lge_1 …
So,
btn1 will go to and play Lge_1(Frame 1 of Gall_Lge_1)
btn2 will go to and play Lge_2(Frame 2 of Gall_Lge_1)
I’m stuck and can’t get it to work..
Here is the site – under ‘Gallery’ so you can see what I’m trying to achieve
http://www.blueshelldesign.com.au/draft/
(I’ve placed in Back and Next buttons next to ‘Gall_Lge_1’ so you can see how its suppose to look when the thumbnails from ‘gall_strip_mc’ are clicked)First, you do not use quotes when you are specifying a frame number, so try changing that first. The only time you use quotes for that argument is for frame label strings.
If it still won't play, are you sure that the button is coded properly and executes the function when clicked? You should put a trace in the function to make sure. Also, you could try using _root instead of _level0... I forget the difference, if any, but _root will definitely get you to the main timeline.
btn2.onRelease = function() {
trace("btn2 clicked");
_root.Gall_Lge_1.gotoAndPlay(2); -
How to stop , play nested movie clips....
Hi all,
I'm calling a swf file in a container_mc, which is in
another swf file(Interface), by loadMovie() method. The Major
problem I've stucked with is that in the interface I'm having a
Play/Pause Button, which is not stopping the nested movieclips of
the external swf file which is loaded in the container_mc
movieclip.
The other major issue is that I'm not able to add a
progressbar(sliderbar) which runs according to the animation, to
this interface. Please help ASAPI have a similiar situation however the container_mc has me
puzzled, I'm not sure what that is - perhaps you can answer my
question:
I have a master swf called index.swf. The index.swf has a
main tool bar of buttons which load frames; each frame is named to
coincide with the main bar button (i.e. genInfo, setup,
mainentance, etc). This works perfectly. My problem is with Movie
Clips.
Each frame has a sidebar which loads external swfs (i.e.
genInfo.swf) - each external swf is made up of a series of Movie
Clips which run in succession along the timeline; each Movie Clip
belongs within its own frame (i.e. MCseg1 is in frame seg1; MCseg2
is in frame seg2, etc).
I need to pause and play each individual Movie Clip at will;
I have built two buttons (pauseBtn and playBtn) into a Movie Clip
called MCpausePlay. The first frame of MCpausePlay contains the
pauseBtn; this frame is coded with the global "stop();" In order to
move to frame(2) which contains the playBtn, the pauseBtn is coded
with -
on(release) {
gotoAndPlay(2);
The playBtn is coded:
on(release) {
gotoAndPlay(1);
When clicked, the MCpausePlay moves from pause to play.
That's all I have been able to get this to do.
How do I code MCpausePlay to pause and then play each
individual Movie Clip? (How do I get a Movie Clip to control other
Movie Clips?). Should I code the Movie Clip, the frames within the
Movie Clip, or each individual button within the Movie Clip? And,
does this MCpausePlay belong on the Index.swf file, or should it be
on each external swf? Or perhaps built in to every Movie Clip? I
have tried all and have not had any success. -
A movie in side another movie clip
I have a movie clip(A) thats inside another movieclip(B). Im
trying to use movieclipA's _x and _y but it gets all messed up.
Does someone know how to fix this.What do you mean, get's all messed up? If clip B is on the
current timeline
then you can get to clip A's properties by going:
trace(clipB.clipA._x);
trace(clipB.clipA._y);
or even:
var ca = clipB.clipA;
trace(ca._x);
trace(ca._y);
Dave -
Head Developer
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.
-
Using cue points to acrivate movie clips
I'm trying to write a simple piece of ActionScript that I can
adapt and re-use easily. (I'm not very good at programming and I've
been finding the "help" information very confusing.) I've devised
quite an elegant solution, if only I could get it to work!.
I'm using a single frame loop with an onEnterFrame
construction that deletes itself when the flv has finished playing.
I've set up a movie clip with various start points for animations
to be activated at cue points. I'm testing for the cue points in
the same frame, storing previous cue point names so that each cue
point triggers the corresponding animation once only. I know the
main logic works because I've tested it with trace statements to
prove that the cue points are actually being reached. The problem
is that the goToAndPlay instructions don't seem to activate the
movie clip as intended.
My best guess is that the stop action on the self-looping
frame is also stopping the movie clip as soon as it starts. Even if
that is true, I don't know how to solve the problem. And I'm sure
one of you much more clever people will know better. Here's the
code. Any suggestions?You can build out a menu by reading the cuePoints array in
the NetStream.onMetadata handler, or by using the MetadataEvent
with the FLVPlayback component (AS3). The simple thing for me to
say is to refer to Chapter 9 of my new Flash Video book. :) (see
link in my signature below.) -
Stopping and Playing some movie clips?
I have a problem with some AS3 code and i don't understand why.. my code looks like this:
stop();
halt.addEventListener(MouseEvent.CLICK, stopplaying);
function stopplaying(event:MouseEvent):void {
MovieClip(root).stop();
MovieClip(root).gun.stop();
MovieClip(root).gun.gt1.stop();
MovieClip(root).gun.gt2.stop();
MovieClip(root).gun.gt3.stop();
MovieClip(root).gun.gt4.stop();
MovieClip(root).gun.gt5.stop();
MovieClip(root).gun.gt6.stop();
gotoAndStop(1);
That code is set to listen to a pause button to pause all movieclips when pressed but the last 2 rows "MovieClip(root).gun.gt5.stop();
MovieClip(root).gun.gt6.stop();" doesn't work and gives me this output:
TypeError: Error # 1010: A term is undefined and has no properties. third_fla at::ppBtn_20/startplaying ()
But there shouldn't be a problem with this, cause the movieclips are the same as the others and has an instance name of gt5 and gt6 just like the other movie clips, and the code is obviously the same?Try tracing the different objects on those lines and see if they are recognized. It may point to a misnaming or object absence.
function startplaying(event:MouseEvent):void {
MovieClip(root).play();
MovieClip(root).gun.play();
MovieClip(root).gun.gt1.play();
MovieClip(root).gun.gt2.play();
MovieClip(root).gun.gt3.play();
MovieClip(root).gun.gt4.play();
trace(MovieClip(root).gun.gt5, MovieClip(root).gun.gt6);
MovieClip(root).gun.gt5.play();
MovieClip(root).gun.gt6.play();
gotoAndStop(2);
Maybe you are looking for
-
I depend on RealPlayer for many things - work that I can only open files I need with it. There isn't a version that now works with the newest version of Firefox. How can I get the previous version of Firefox back so I can use my computer to do my bus
-
Hi experts, We are doing a query on GL Cube. Our requirement is to show DZ documents and the reversals of DZ documents i.e RD documents How to find RD documents related to DZ documents only ? There may be chance that reversal documents ( RD ) will b
-
A user is receiving an alert on a list when anything is modified, but the alert is just a blank email. Anyone experience this behavior before?
-
Hyperlinking from a PDF to a website
Hello, I have a PDF that is basically a map image. It has several points on it that are representing water wells. I would like to link these points to a table from a web site, so the beginning of the link would be http://www..... How do I do this?
-
Hi there! I am trying to use the RSA algorithm to generate a keyPair. I am then using that public key f that keyPair to initialize a Cipher object. BUt htis is not working because I am getting an error saying "java.security.NoSuchAlgorithmException: