Access Function On Root Frame From Movie Clip?
Hi,
I'm trying to have my movie clip call a function in my root timeline frame 1, but I'm not sure how to or even if this is the best way to do this.
I have a function that shuffles trivia questions then randomly shows one for 10 seconds, then the answer for 5 seconds. Then I want it to shuffle again and display another question/answer etc...
So I added an addEventListener(Event.ENTER_FRAME) to the last frame of my movie clip, but I'm not sure how to make it go back to the main timeline and play again.
Thanks for your help.
Tony
KirupaForum > Flash > ActionScript 3.0
Posted on: 06-23-2008, 08:02 PM
View Complete Forum Thread with Replies
Sponsored Links:
How To I Go To The Next Frame Of Root From A Movie Clip?
I am trying to do up the framework for a flash project which has a transistion fadein and fadeout whenever it loads a new content but faces no result. How is this done? I have created fade in and fadeout as movieclips. Is there any script that I can use in my fadein movie clip that tell the root frame to jump to another frame?
View Replies !
View Related
How To Execute A Function On The Root From A Movie Clip
Hello,
I am fairly new to AS3.0, so this is kind of a newbie question.
I have a function on the root timeline called addWave()
I would like to call that function from within a movie clip, but when I use
root.addWave(); or parent.addWave();
Flash acts like I am crazy
1061: Call to a possibly undefined method addWave through a reference with static type flash.displayisplayObject.
I would like to know how to run a function from another timeline in AS3.0.
PS: I am not using packages, so please give me a packageless solution
Thanks.
View Replies !
View Related
Access Movie Clip's Frame Names
Hello all,
Hope this is not a repeated topic, if it is sorry in advanced. I'd like to known if there is any way to access (using actionscript) the frame names given in a movie clip that is then inserted to the main timeline. In other words access a movie clip symbol's frame names from the main timeline. If anyone knows any other more elegant way I'm open to suggestion, I just really don't like using things like mcInstance.gotoAndPlay(_global.var)
Thanks in advance
View Replies !
View Related
How To Access A Function From Loaded SWF / Trace Root
I have a function as part of an imported SWF, but I cannot seem access it through the timeline of the parent movie. My assumption is that I am not using the correct path, but I cannot locate the correct path.
Does anyone know how to trace from the root of the parent timeline to a MovieClip inside of an imported SWF?
View Replies !
View Related
How To Access A Function From Loaded SWF / Trace Root
I have a function as part of an imported SWF, but I cannot seem access it through the timeline of the parent movie. My assumption is that I am not using the correct path, but I cannot locate the correct path.
Does anyone know how to trace from the root of the parent timeline to a MovieClip inside of an imported SWF?
View Replies !
View Related
Creating A Function On The Root Timeline From A Child Clip?
How do I creating a function on the root timeline from a child clip? This is the function I need to create:
function up(men_num) {
var men_offset=offset[men_num]-30;
men_num++;
for(i=men_num; i<=5; i++){
MenuArray[i]._y-=men_offset;
}
}
function down(men_num) {
var men_offset=offset[men_num]-30;
men_num++;
for(i=men_num; i<=5; i++){
MenuArray[i]._y+=men_offset;
}
}
View Replies !
View Related
[F8] Clip Loads If AS Is On Root Stage, But Doesn't Work When I Put It On The Frame I Want
I'm confused. the following code (which tries to load an external .swf onto the stage) works when it's the only thing in the .fla file, when it's on the _root stage, but when I put it inside my movie in a sub-clip, it does absolutely nothing -- no event handlers are called for the movie load event, and nothing shows up on the stage. I can only tell the code is being called because of the trace("1").
why would this work only on _root and how can I work around this?
thanks in advance,
Gum P.
code:
trace("1");
createEmptyMovieClip("xcIntro", this.getNextHighestDepth());
var mclListener = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
trace("movie loaded");
}
mclListener.onLoadStart = function(target_mc:MovieClip) {
trace("movie load started");
}
var intro_mcl:MovieClipLoader = new MovieClipLoader();
intro_mcl.addListener(mclListener);
intro_mcl.loadClip("test.swf", xcIntro);
View Replies !
View Related
Jumping To A Frame, Then Access A Clip
Hello,
I have just encountered something very strange in flash 8. I was so sure this would work, but I guess not... or am I just missing something here?
My timeline looks like this (I shall attempt some asci art here, as I can’t seem to attach an image :P):
...[13][14][15][16][17][18][19][20][21][22][23][24][25][26][27] - my frame numbers
...[________][ a ][_______________________________] - at frame 16 is some code
...[________________________________][*||||||||||||||||||||] - frame 24-27 is a movieclip
The movieclip is a timerClip I’ve made, with a class "attached", it looks something like this: (at bottom of this post, -there are more methods then what is shown). The clip is also given a name called “timerClip”.
At frame 16, is some code (which is actually in a function, but from testing, it doesn't really matter):
gotoAndStop(24);
trace(timerClip);
timerClip.startTimer(10000);
stop();
I call that function/run it at some random frame (between 16 and 23) and my timer doesn’t go off. Yet, when I trace “timerClip”, it is able to find it (it comes up “_level0.timerClip”). I can still, play it manually, etc (by calling whatever methods the Movieclip class has). Is this actually not doable in flash? -jumping to a frame, and calling the clips on that frame? *somewhat confused*
Attach Code
// just here to show how my class is setup (what I meant by “attached”)
class TimerClip extends MovieClip {
public function TimerClip(){
}
public function startTimer(inputTime:Number){
// some implementation here
}
}
Edited: 09/08/2007 at 10:25:45 PM by Some1Won
View Replies !
View Related
Goto Frame Of Root Movie...
I've made a button which sits inside a movie on the stage, and I want when clicked to 'goto frame' on the root movie.
I've done this before (and I know it's not tough) but I just can't find where I did it...
Cheers
Rob
View Replies !
View Related
Calling A Function On Root From A Loaded Movie
Ok,
when calling a function on root from movieClip inside a swf Ive loaded onto a layer above what path can I use? I dont want to use _parent._parent._parent.function cos thats just stupid.
Ive tried _root.function
Ive tried _level.0
Neither of these seem to work for me. What am I doing wrong?
View Replies !
View Related
Button Within Movie Clip - Root
Ok, I've been searching for this answer for hours and I keep only finding way too complicated explainations or info for AS2.
I have a button within a movie clip: (I promise I'll make the file smaller, still working on it)
http://www.southseasspas.com/flash/spas/spas.swf
How do I make that "Back" button go back to the frame labeled "Home"? Button is named "back_btn". Movie is named "530L_mc". Please help, I'm loosing hope.
This works great, but I only want it to go to "Home" when the button is clicked.
Quote:
MovieClip(root).gotoAndStop("Home");
This is not working:
Quote:
function goBack (e:MouseEvent):void{
MovieClip(root).gotoAndStop("Home");
}
back_btn.addEventListener(MouseEvent.CLICK, goBack);
Error: 1120: Access of undefined property back_btn.
But the button is named "back_btn" -so I don't know what's wrong
View Replies !
View Related
Button Within Movie Clip - Root
Ok, I've been searching for this answer for hours and I keep only finding way too complicated explainations or info for AS2.
How do I make the "Back" button in the seperate movie clip go back to the frame labeled "Home"? Button is named "back_btn". Movie is named "530L_mc". Please help, I'm loosing hope.
This works great, but I only want it to go to "Home" when the button is clicked.
Quote: MovieClip(root).gotoAndStop("Home");
This is not working:
Quote: function goBack (e:MouseEvent):void{
MovieClip(root).gotoAndStop("Home");
}
back_btn.addEventListener(MouseEvent.CLICK, goBack);
Error: 1120: Access of undefined property back_btn.
But the button is named "back_btn" -so I don't know what's wrong
View Replies !
View Related
Loading External Movie From A Movie Clip In The Root
Hey, I ran into some problem with the webstie that I'm designing.
Let's say the root movie is main.swf and within the main.swf, there is a movie clip called buttom that controls the buttom animation. when I push that buttom, I want it to load an external movie, say, external1.swf into the main.swf.
I have the empty movie clip on the stage on main.swf . When I try to load external1.swf, it just wouldn't do it? (I'm using the loadMovie("url","target")command)
Is there anything wrong?
Thanks
View Replies !
View Related
Having Problem Showing Movie Clip In Root
I have a file called index which has a menu of six items in frame 6. Frame one initializes my variables and indicates the variable for each of the menu items is set to false.
In frame 6 the user selects a menu item and that takes them to frame 7. In frame 7 an external .swf is loaded. When they complete that module they are returned to frame 6, where I want to have a checkmark indicate they have completed that module. I have that named and in a movie clip. I for some reason cannot get this to work.
This is the code I have for the parent movie in frame 6
advanceModule()
function advanceModule() {
if (advancedone == "true") {
advancedone_mc._visible = true;
finished();
}
advancedone_mc._visible = false;
}
This is the code I have at the end of the loaded swf
test_btn.onPress = function() {
with (_root) {
prevFrame();
advancedone="true"
}
};
Can someone please help me show the advancedone_mc when the advance module is completed?
Thank you.
View Replies !
View Related
Navigation Fromindise Movie Clip To Root.
i am trying to design some movie in MX. i have designeed my buttons in a movie clip and placed that movie clip on root. now all my lables are on root. and i want to navigate on root. but it could not detect lables or root... but its looks for lables inside movieclip.
can any one tell me how can i do this job?
my code is like that...
on (press){
gotoAndPlay ("p1")
}
p1 is my lable on root.
thanks in advance
View Replies !
View Related
Control Root Timeline From A Movie Clip
Hi,
I am sorry to ask a probably obvious question, but I just can't find the answer.
In Flash CS3 using Action Script 3, how can I tell the main timeline to gotoAndStop(); a certain frame from within a movie clip.
Let me explain.
I have a menu (which is a movie clip) with various buttons. Each button corresponds to a certain frame in the main movie. So if a user click on Button1, it should gotoAndStop(1); and Button2 should gotoAndStop(2); and so on.
In Action Script 2, I could use _root.gotoAndPlay(2); from what I understand, but that does not work in Action Script 3.
I am not looking for the mouse events, I have that working already.
Thanks.
View Replies !
View Related
Accessing A Root Variable From A Movie Clip
Hey all - pretty new to Flash here, so hope ya don't mind helping with some (hopefully) easy questions.
I made a variable in my root timeline, and want to be able to access it from a movie clip.
In the root: var chapterframe:int;
In my movie clip: MovieClip(parent).gotoAndPlay(5)
I would like to replace the number 5 with the value of the variable chapterframe, but well... I've tried several things, but nothing works. Any suggestions?
Thanks,
~ Nick
View Replies !
View Related
Call Method In Root From Movie Clip
Hello All,
In AS 2, I was able to call a method declared in the root timeline from a moviclip by placing code similar to "_root.callMethod()". I'm trying to do the same in AS 3 but I get an error "1119: Access of possibly undefined property st through a reference with static type flash.display:DisplayObject."
On the first frame of my main timeline, I have:
var st:String = "HELLO";
I also have a movieclip on the main timeline that has the following on its 1st frame:
trace ("ST FROM ROOT FROM CLIP -- " + root.st);
When runned, I get the error above.
How do I get access to variables declared in other clips and main timeline as well as calling methods declared in other MC and main timeline?
Thanks for your help in advanced.
V
View Replies !
View Related
Movie Clip Telling Root To Do Stuff
here is my code. it is on a movie clip which you can control to move left and right.
if (this._x<=0) {_root.gotoAndStop(3);}
im expecting that when the clip leaves the left side of the screen, the movie will jump to frame 3 of the current scene. but for some reason, it is jumping to the 3rd frame of the entire movie. so i tried this:
if (this._x<=0) {_root.gotoAndStop("Scene 2", 3);}
but this infact does absolutely nothing.
im confused. please help. its hurting my brain.
View Replies !
View Related
Unloading Movie Clip From Root Container
Hi, I've created a main page with my main links on top, and a container as my body.
I load my pages with this action to the container. NO PROBLEM.
on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "production";
container.loadMovie("production.swf");
} else if (_root.currMovie != "production") {
if (container._currentframe >= container.midframe) {
_root.currMovie = "production";
container.play();
}
}
}
Inside the production.swf files I've created a gallery with a MovieClip that loads from my library to a container1 inside the production.swf. In the galleryMC(from library), Ive created a close button to unload it from the container1. It works fine from my production.swf file, but when it loads to the main page it doesn't unload. This is the ActionScript that I have to unload the Movie Clip.
on (release) {
this._root.container1.unloadMovie();
}
can some tell me how can I fix this problem please.
Best Regards
View Replies !
View Related
Attaching Custom Movie Clip To Root
Hello
Ive just began work with FlashDevelop and im trying to take a little (lot) more object oriented approach than before
So ive created a class which extends MovieClip to try and show it in main class.
This is my code for the MC:
Code:
class ui.UIPanel extends MovieClip
{
var mainStopwatch:TextField;
public function UIPanel()
{
initElements();
}
private function initElements():Void {
mainStopwatch = this.createTextField("mainStopwatch", this.getNextHighestDepth(), 50, 50, 100, 50);
mainStopwatch.text = "test";
}
}
And the main class:
Code:
import ui.UIPanel;
class Main
{
public static function main(swfRoot:MovieClip):Void
{
var userInterface:UIPanel = new UIPanel();
_root.attachMovie("userInterface", "UI_mc");
trace(userInterface);
}
public function Main()
{
}
}
So basically im asking how you do something like this since the above code doesnt work. And i would also appreciate any advice you have on this matter
View Replies !
View Related
Targeting A Frame In The Main Timeline Of The Root From An Externally Loaded Movie
Hi! I'm trying to target a frame called "home_portfolio" on the main timeline from a loaded swf. Here's the code on the portfolio button:
on (release) {
tellTarget ("_root") {
gotoAndPlay("home_portfolio");
}
}
On the "home_portfolio" frame is an action to load the portfolio movie. However, it ignores this.
After reviewing some of the other posts I've changed the code on the portfolio button to be"
_root.gotoAndPlay"home_portfolio"
yet when I publish the swf the output says
Symbol=_bottom nav, Layer=text, Frame=1: Line 1: ';' expected
_root.gotoAndPlay"home_portfolio"
I don't understand why either one of these codes won't work. Can you help? Thanks so much
View Replies !
View Related
Root Mouse Location Detected Within A Movie Clip...
I couldn't find anything that specifically covered this, but I'm trying to detect the location of the mouse in relation to the root of my movie - not of the movie clip this code resides on. What's the deal with my code...? It's not continually returning the root mouse position...
code:
mcDragBar.onPress = function() {
startDrag(_parent);
_root.onEnterFrame = function() {
trace("mouse location x = " + _root._xmouse);
trace("mouse location y = " + _root._ymouse);
}
}
View Replies !
View Related
Suspend Root Till A Movie Clip Finished
sorry Iam new in this , please some one answer me asap, why this dosen't work:
on (release)
{
_root.scrn.gotoAndPlay(1);
_root.shm.gotoAndPlay(1);
if (_root.scrn.isActive() &&_root.scrn._currentframe<48 )
{
_root.gotoAndStop(18);
}
else (_root.scrn._currentframe==48)
{
_root.gotoAndStop(19);
}
}
View Replies !
View Related
How To Define A Variable On The Root From Inside A Movie Clip
Hi
I want to define a variable on the root from inside a movie clip, so that when I save a value in it I can reach it from another movie clip, if this is not possible, what should I do to declare a public value that can be accessed by any movie clip on the stage but without using the main time line?
I hope if you have an answer, to write a definition code example with your answer.
thanks a lot.
View Replies !
View Related
Control Root Movie Clip With External Button
Hi,
In lay-mans terms i have a main movie (level0 by default). You click on a button to load an external image (level1).
Under neath this now loaded image (mc) (level1) , on level 0 movie has the main site navigation buttons that are still active, which i want to de-activate (as it very easy to click on them by mistake, i can do this part.
But when the user unloads the image in level 1, i want the main buttons to go live again.
So on the main movie level0 my buttons are instanced as 'red' and have
two key frames - "active" buttons (active) on the timeline and "not active" buttons with both these labels.
So my level 1 movie when it unloads itself (via a button)
i have -
on release
tellTarget
("red")
gotoAndstop("active")
this does not work;
How do i tell level1 button to control a clip on _level 0 ??
i remember i used to put _levelx after mc instance year ago, but i have forgot how to implement it, since flash has now changed, and im using old version.
i can email a basic version over if anyone want to take a look.
Im using MX 2002 - don't give me any samples as i have never been able to open anything :( , from you very helpful members.
best,
rai
EDIT;
ok i just got it to work with the levels. But my problem now is this
by previously making the buttons on level0 a symbol (mc), the navigation stops working so i can no longer seem to go to other parts of the movie, instead of going to new labels on the main movie level0 scene 1, its just seems to play the timeline of the button MC within itself - movie clip 'red' and goes to active and not active labels.
Close but so far :(
Edited: 11/25/2007 at 04:53:51 PM by raigraphixs004
View Replies !
View Related
Tween Problem With Movie Clip On The Root Stage
The basic gist: I have an swf loaded into a movieclip on the stage. It plays fine, I can reference it without any problems. When I motion tween the holder clip on the root stage, however, it seems to unload the loaded movie... I checked it with a variable that I loaded within the loaded movie; as soon as the thing is tweened, that variable goes null. Don't want .swf to disappear.
I can’t find any untoward place with an unloadMovie() action, there’s nothing obvious that would be unloading the movie... Am I doing something stupid? Do I not know something I should? I’m authoring in Flash 8, exporting as Flash 6, for the record.
Thanks for any help.
View Replies !
View Related
How To Define A Variable On The Root From Inside A Movie Clip
Hi
I want to define a variable on the root from inside a movie clip, so that when I save a value in it I can reach it from another movie clip, if this is not possible, what should I do to declare a public value that can be accessed by any movie clip on the stage but without using the main timeline?
I hope if you have an answer, to write a deifinition code example with your answer.
thanks alot.
View Replies !
View Related
Trouble Controlling Root Timeline From Movie Clip
This is probably simple, but I'm new to AS3 and am stumped!
I'm trying to control the root timeline from a movie clip. On the last frame of the movie clip, I have:
MovieClip(root).gotoAndPlay (10);
which successfully brings me back to frame 10 on the main timeline. However, from here, none of the ActionScript that is on Frame 1 seems to work... the rollovers aren't working, except on those embedded in a separate movie clip.
Any suggestions?
View Replies !
View Related
Movie Clip Object Restarts Itself When Root Moves It
[ I've had a hard time trying to find any information on this by searching - the keywords are so generic, I get a lot of results but nothing that answers my question. ]
I'm working on a website design and can't figure something out...
I have a movie-clip object in my root timeline - a slide-out menu. The root tweens the clip into place, then the clip becomes active (via some crafty variable coding on my part). Mouseover will slide out the menu, mouseout will close it. Clicking on a menu item will jump down the clip timeline to play a different ending (one without a layer becoming opaque, but the menu still rolls up).
When there's a click, once the clip hits its end frame, there's 2 actions - a stop action and a _root.gotoandplay action for the root to then tween the clip over to the side.
My problem is that when the root tweens the clip, the clip doesn't stay at its end stop frame, it seems to reset itself to frame 1.
Why is it resetting itself? In theory, if I set the menu-open as the last frame of that clip, shouldn't it stay open when the command is sent to the root for it to perform the tween? Or is it the keyframe resetting the movie clip object (which is instance-named)?
I can provide more details if needed - or even post the site.
View Replies !
View Related
Movie Clip Object Restarts Itself When Root Moves It
[ I've had a hard time trying to find any information on this by searching - the keywords are so generic, I get a lot of results but nothing that answers my question. ]
I'm working on a website design and can't figure something out...
I have a movie-clip object in my root timeline - a slide-out menu. The root tweens the clip into place, then the clip becomes active (via some crafty variable coding on my part). Mouseover will slide out the menu, mouseout will close it. Clicking on a menu item will jump down the clip timeline to play a different ending (one without a layer becoming opaque, but the menu still rolls up).
When there's a click, once the clip hits its end frame, there's 2 actions - a stop action and a _root.gotoandplay action for the root to then tween the clip over to the side.
My problem is that when the root tweens the clip, the clip doesn't stay at its end stop frame, it seems to reset itself to frame 1.
Why is it resetting itself? In theory, if I set the menu-open as the last frame of that clip, shouldn't it stay open when the command is sent to the root for it to perform the tween? Or is it the keyframe resetting the movie clip object (which is instance-named)?
I can provide more details if needed - or even post the site.
View Replies !
View Related
Opening Movie Clip From Root Movie
well, I have doors that open and close when a new movie is loaded
since the doors are a movie of there own I need to figure out how to jump to frame 11 inside the door movie
from the root movie
(the doors are loaded into a level from the main movie)
can anyone help?
View Replies !
View Related
How To Play Root-level Sound From Within A Nested Movie Clip?
I've got this AS on the first frame of my main FLA:
PHP Code:
var spur1:Spur1 = new Spur1();
var playSpur1:Function = function() {
spur1.play();
}
playSpur1();
It works. When the movie starts playing, I hear the spur sound from my library immediately.
I have a cowboy MovieClip on my stage in frame 1. The 2nd frame inside that cowboy movie clip has a movieclip of some legs walking. The 1st and 6th frames of those legs walking has this actionscript:
PHP Code:
playSpur1();
This is causing an error:
Code:
1180: Call to a possibly undefined method playSpur1.
My movie will not run properly - the cowboy ignores all the internal actions and loops repeatedly.
What is the recommended way to play a sound when some deeply nested movie hits a certain frame?
View Replies !
View Related
How To Reference Root-level Sound From Within A Nested Movie Clip?
I've got this AS on the first frame of my main FLA:
PHP Code:
var spur1:Spur1 = new Spur1();
var playSpur1:Function = function() {
spur1.play();
}
playSpur1();
It works. When the movie starts playing, I hear the spur sound from my library immediately.
I have a cowboy MovieClip on my stage in frame 1. The 2nd frame inside that cowboy movie clip has a movieclip of some legs walking. The 1st and 6th frames of those legs walking has this actionscript:
PHP Code:
playSpur1();
This is causing an error:
Code:
1180: Call to a possibly undefined method playSpur1.
My movie will not run properly - the cowboy ignores all the internal actions and loops repeatedly.
What is the recommended way to play a sound when some deeply nested movie hits a certain frame?
View Replies !
View Related
Making A Rewind Button 1 Level Down From The Root Work For A Movie Clip
Hi there. I'm a relative newcomer to the wonderful world of actionscripting, and I can't seem to find an answer to this problem by searching for it on the Web. I have a movie that contains two clips: one is a controller movie clip, "reverse", located on the first level, that has 3 frames - the actions stop(); on the first, _root["artworks"].prevFrame(); on the second, and gotoAndPlay(2); on the third. What this is intended to do is play the movie clip "artworks" backwards until a stop(); command is reached in that clip. The clip "artworks" is also located on the first level, and has a button that, when pressed, says: on (release) {_root["reverse"].gotoAndPlay(2); } - this is intended to cause the clip "reverse" to go to the second frame, which should make the clip "artworks" play in reverse. Of course, this isn't working out like I expected it to - it isn't working at all. When the button is pressed, nothing happens. I hope someone out there can let me know what I'm doing wrong, and hopefully what I can do to fix things. Thanks in advance.
View Replies !
View Related
AS3 Root Access
In one of senocular's AS3 tips (http://www.kirupa.com/forum/newthrea...=newthread&f=9) he mentioned using a TopLevel class which would then be extending by the document class to create "global" root access. Instead of making my document class extend TopLevel, could I assign stage and root properties directly to the document class, from inside the constructor? For example:
ActionScript Code:
package { import flash.display.MovieClip; public class MyDocumentClass extends MovieClip { public static var stage:Stage; public static var root:DisplayObject; public function MyDocumentClass() { MyDocumentClass.stage = this.stage; MyDocumentClass.root = this; } }}
EDIT: Or maybe not define those two properties at all, just reference MyDocumentClass.root from whichever class I need root access too?
Cheers,
ghjr
View Replies !
View Related
|