ActionScript 2.0 :: Calling A Function To Change Frames In A Mc On Root Timeline?
Sep 26, 2005
I have created a function on the root timeline, to be called at a certain point (when the character is on a certain frame and so is the certain item, he loses a life)the lives_mc advances frame by frame to show lives being lost.heres the function
Code:
function loseLife(){
if(_root.lives_mc._currentframe=1){
_root.lives_mc._currentframe=1[code].....
View 7 Replies
Similar Posts:
Apr 12, 2010
how can I call an MC on root timeline from a button inside another MC?
View 1 Replies
Dec 23, 2009
This is kinda complicated, and I'm still trying to wrap my head around the whole concept of OOP. So right now I am building a XML Gallery, and in the FLA (Root) I've added the thumbnails. Everytime the thumbnails been clicked, it will bring up the "Detail" movieclip, which also is created in the root. And inside the Detail movieclip, I am creating a few buttons with an external class. My question is how can I call a function in the FLA (Root) when I click on the buttons inside the Detail movieclip? Note it seems I've successfully import my external class in both the root and the Detail movieclip.
View 7 Replies
Apr 27, 2010
I've got a movieclip on the root of the stage called "bgImg", in that clip I've made this function:
Actionscript Code:[code]..........When you click a button in the nav it loads a movieclip to the stage from the library, inside this movieclip I have a row of buttons,when you click one of these I want to call the function in the movieclip on the root (ie. the function inside "bgImg" .
View 3 Replies
Jan 1, 2006
i've got this mc component i've created and reuse on some sites i've made. It's a real simple shoutbox that grabs info from a database using a php script.What i'd like to do is have this component refresh every 200 frames, which means, grab most current msgs and post them in the database.so for example, i have a movieclip called MC1. there's a function in MC1 that goes like: grabdata = function() {}; this basically calls the php scripts, loads the info, and so on.i wanna call this function from the root or even a parent MC.I have considered using prototypes or a class, but i dont think it's really necessary for something that seems basic enough.
View 1 Replies
Jul 18, 2010
I'm switching from as2 to as3 and everything was going swimmingly with my new site until i tried to use a _root call to a function on the main timeline by a loaded movieClip that is loaded nested into 2 other movieclips. the movieClip needs to tell the _root when it's done playing so the root knows to load the next one in line through a php call. Everything works except for the _root call. In as3 there's no such thing as root anymore so I figured no big deal, i'll just find out what the new thing is and holy crap wtf! I can't figure this out!! I've read from doing stuff like custom eventLisnters (which i am trying now) and casting the root as a movieClip and then I read this whole crazy tutorial on building an event structure and the proper MVC way of coding and blah blah blah ALL I WANT TO DO is tell the _root that the loaded MC has reached the end of its timeline. Basically if it were as2 i could just go _root.loadNext(); and it would work.how to make a loaded MC talk to the _root timeline and call a funciton from there?
View 19 Replies
Nov 7, 2011
How do you tell the root timeline to root.gotoAndStop(2); from the timeline of a movieClip added using addChild?In the maintime line I have
addChild(fade_eng);
and in fade_eng I have the following on frame 20
root.gotoAndStop(2);
this.gotoAndStop(1);
But I am getting 1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:Stage.
View 1 Replies
Dec 8, 2011
I want to call a function that is inside the root timeline of Flash from an external class.
This code is from the class:
private function loadImage(event:Event):void
{
addToContainer()
}
[Code].....
View 3 Replies
Aug 17, 2009
im attempting to keep it as portable as possible so its easier to edit later, and i dont have to go around copying/pasting too much code. - i'll cut to the chase..
On my main timeline, i load all the image-file names, as variables.. using loadvars into thumbnails, which ive given instancenames Loader_1 to Loader_20, inside these thumbnails is the Loader component Thumb_1. Here is the code on the main timeline, to load these variables.
Code:
BigLoader._visible = false;
var my_lv:LoadVars = new LoadVars();
// load variable function
[Code]....
how i could make this more portable without -completely- changing the format its in [so i can still understand it]
View 9 Replies
Nov 9, 2009
I have a movieclip in which I show pictures. Each picture was 1 frame long, so my button (mc) to go ahead to the next picture had the following script:
this.onRelease = function(){
_parent.nextFrame();
}
Now I've changed the timeline so that each picture is 24 frames long. By reading some posts I've found this code:
gotoAndStop(_currentframe+5);
Still I don't manage to go ahead 24 frames. Does anyone know how I can change the first code to go ahead 24 frames, or even better, to the next keyframe?
View 8 Replies
Dec 4, 2009
I have a MC1 with a class that controls it on my timeline. Within this MC there is a second MC2 which contains a short animation. During that animation i need a trigger that will call a method from the class attached to the main MC. MC1 is linked to CLASSMC1 contains MC2(short animation)MC2 calls a function in CLASS
Code:
package {
public class CLASS {
[code].....
View 1 Replies
Oct 13, 2008
I decided to rewrite my question from an earlier post...I'm using the TextMetric class: URL...The code below currently resides on the attachedMC timeline, and is written twice with different variables for each time called for each dynamicText.[code]What i am trying to do (emphasis on trying) is write the code on the main timeline, so that it can be called from any attached MC, a sort of global function if you will. Another thing to note is that there are multiple dynamic Texts using the function at the same time.[code]
View 4 Replies
Apr 7, 2009
in my menuButton class I add an eventlistener but moveAlong is on the main timeline how do I call it?[code]
View 1 Replies
Aug 5, 2009
I have a project which requires the loading and unloading of multiple "scenes". All my navigation is working (probably not the most efficient way) but I'm having one issue. I need a button on one of the loaded SWFs to call a function on the main timeline. Since Actionscript 3 no longer supports the _root functionality the way AS2 did, I cannot access the main timeline.
In general, how do I get to the root of the main timeline without using _root?
Also, how can I reference the loaded SWF and objects inside of it from the main timeline?
View 1 Replies
May 12, 2008
I've tried looking everywhere for this answer, but I'm still at a loss. I'm beginning to think it's not possible or I'm just not looking in the right places.I have three swf files. The main container and then two external swf files being loaded into the main swf. Swf 1 (frame.swf) has a function on the main timeline that needs to be called from a button in swf 2 (toolbox.swf). My initial thought was to place the actionscript of frame.swf into a movieclip and call it from toolbox.swf using:_root.callFunction("PH", "doPhone");Although this would work, I cannot use this option. The actionscript of swf 1 must stay in the main timeline. Using a class file is not an option either. Is there any other way to call a function from the main timeline of an external swf?
View 1 Replies
Sep 27, 2010
So this was quite simple in AS2, but considering that _root is no longer around, how can I call a function that is on the main time line from a nested movie clip?
This is what I have inside my movie clip:
Code: this.hit_mc.addEventListener(MouseEvent.CLICK, updateScore); I tried using Stage.updateScore, but that didn't work either. This is the error I'm getting:
1119: Access of possibly undefined property Stage through a reference with static type flash.display:Stage.
View 2 Replies
Aug 12, 2009
i am getting a "ReferenceError: Error #1069: Property beginTargetLock not found on AimCursor and there is no default value."
[Code].....
View 2 Replies
Aug 26, 2010
I'm trying to call a function called checkForHit() located inside of my Hero class at a particular frame of an attack animation of my Hero object. Meaning, when his weapon is at the point in the animation where it could collide with any enemies, I want to call the function that performs the check.My Hero Movie Clip is set up where it contains a Movie Clip on different frames that coorespond to the different animations (attacks, movements, etc). So the Hero MC contains a bunch of other MCs. That way I can just use hero.gotoAndStop("attack1");
The problem that I'm having is that the code that I wrote to call the checkForHit() function is written on one of the frame of the nested MC's timeline, and it's not being recognized. In fact, even if I put a trace("HELLO") on any of the frames on the nested MC, it's not being output. I even tried to put something that I know should cause an error on one of the frames, and it ran without throwing an error. It's almost like the code on the timeline isn't being compiled, or it's being skipped over somehow.
View 1 Replies
Mar 1, 2008
For over a week now, I've bee struggling with this problem for my current project, which involves many more challenges besides this one, and is soon to reach the deadline. Needless to sayHere, is a simple HTML page with an iFrame and a button that changes the source URL of that iFrame. The following is the page source, which can also be viewed from browser - simple as that.
HTML Code:
<head>
<script type="text/javascript">
[code]....
View 1 Replies
Jun 10, 2010
I am on the main stage. In a layer I create a button. I double click on this button to enter its layer. I then do some AS3 to say if the play button is pressed, to change to a pause button. How would I say "If the main timeline is finished, change to the play button"? I am trying
[Code]...
View 1 Replies
Sep 16, 2010
I have my main fla and then I have a actionscript named bullet.as.in the bullet.as I create a bullet using "this" throughout the script now how would I call the bullet on my main timeline?
View 3 Replies
Jan 26, 2004
I'm having a few problems with the php tutorial. I've got all the actions in my main timeline and calling them using instances. I have a mc called formset with an instance of formset in which is another mc called form with an instance of form which on the mc has the following code -
onClipEvent(data){
// show welcome screen
_root.formset.nextFrame();
}
I have a submit and back buttons with the following syntax -
formset.submit.submitbutton.onRelease = function(){
this.formset.form.loadVariables("email.php", "POST");[code]..........
I've a feeling I'm calling the timelines wrong with the root handlers etc.
View 1 Replies
Feb 15, 2010
If I have a movieclip loaded with Loader and I want it to call back down to the movie that loaded it how do i do that? Referencing a root object just gets me to the root of the child not to the main stage.
View 1 Replies
Dec 5, 2009
how many of you use scenes to get your projects done. I've been switching to a different scene for every new angle (I'm making a flash movie, drawing somewhat 3D perspective, and storyboarding it out like a movie.) I find it makes it easier to organize the timeline, and not take up as many frames per timeline. Are there any downfalls to this method? Because I'm early on in the production, and if there's going to be any problems down the road I'd like to know before I get too involved.
View 1 Replies
Aug 20, 2006
I have a root timeline in which contains a movie clip on a certain frame. Inside that movieclip, on it's second frame, there is a button. I would like to use this button, when clicked, to move take the user to a frame on the root timeline.
View 5 Replies
Jun 29, 2010
So im new to AS3 im trying to do some basic things that i knew in as2 but they arent working in AS3.Im basically trying to do this.this.gotoAndStop("1");basically i just want my main timeline to jump back to the beginning the main time line
View 2 Replies
Mar 26, 2009
What I'm trying to do is very very basic however its flat out not working. I'm trying to add a event listener to a button located within a movieclip thats on the root time line.Here's the code:
Code:
function main_init():void
{
[code].....
View 2 Replies
Jul 7, 2009
I am using Flash CS4 and Actionscript 2.0, and I want to be able to run a certain command for a time I am making only on certain frames...
[Code]...
This doesn't work. The reason I am trying to do this, is because every time I complete a level the timer is still going at the 'congratulations screen' and then when I go to level 2 the timer would start up again, and the seconds would go twice as fast.
View 1 Replies
Feb 24, 2010
I have a movielclip, nav_mc, inside which contains my navigation buttons. Lets say I want to effect the time timeline. Before in AS 2.0 I could simply go
jan1_mc.onRelease = function() {
_root.january_mc.gotoAndStop(2);
}
Now in AS 3.0, nothing works.
button_mc.addEventListener(MouseEvent.MOUSE_UP, doIt);
function doIt(evt:MouseEvent):void {
_root.january.gotoAndStop(2);
}
That doesn't work. Returns this in errors:
Warning: 1058: Migration issue: The property _root is no longer supported. This property has been removed. The closest equivalent is the Stage, which serves as the root of the ActionScript 3.0 display list..
Neither does
root.january.gotoAndStop(2)
or
stage.january.gotoAndStop(2)
(1119: Access of possibly undefined property ball_mc through a reference with static type flash.display:Stage.)
or
_stage.january.gotoAndStop(2)
or anything!
How do we do this very simple thing now in AS 3.0
TLDR;
How do I reference the _root timeline in AS 3.0 since _root. no longer works in 3.0
View 3 Replies
Mar 11, 2011
I created a movieclip called holder in my Stage and I name it, inside them i put a variable called
name = "whatever"
Now I can't access the variable from root timeline, I try this:
trace(holder.name);
The result gives me undefined! what mean this?
View 1 Replies