ActionScript 3.0 :: MovieClip(root).gotoAndStop(myFrame); Returning Null?
Jul 26, 2011
Ive embeded my game.as file as a movie clip into a new .fla which has 1 frame for the game, 1 frame for the win screen, 1 frame for the loose screen and 1 frame for the intro screen.
So at the end of the game I do MovieClip(root).gotoAndStop(myFrame);
where my frame is either the win screen or the loose screen frame.both screens have a playagain button that returns me to the game frame.Sometimes I get the error after the first win/loss sometimes I get it after I do play again and then when I win/loose.
the error is at:MovieClip(root).gotoAndStop(myFrame);
Im not exactly sure why or how to fix it though any tips?
View 3 Replies
Similar Posts:
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
Aug 7, 2010
I created a Sponsorbar which dynamically adds sponsors according a XML script.
ActionScript Code:
for each( var imgPath2:XML in xdata.img )
{[code]...........
View 2 Replies
Oct 18, 2009
I want to tear my hair out and cry! I've just upgraded to CS4 and am trying to create a simple swf that consists of a root timeline with various frames, each labelled 'home', 'bio' & 'contact'. There are buttons on the stage with instance names and then on the first frame of my root timeline I have the following code (as well as the _root.stop() as actionscript on the labelled frames):
Code:
_root.stop()
homebtn.onRelease = function():Void {
[code].....
View 2 Replies
Nov 30, 2009
PHP Code:
var aaa:Sound = new Sound (new URLRequest ("awd awd.mp3"));aaa.play ();trace (aaa.id3.artist);
The song plays but when I try to get the song's artist / album it returns null. I also tried copying the format from live adobe help website but it still returns null.
Also I have 3 songs named 1, 2, and 3 in a folder. I made a playlist type thing and it works fine, the only problem I see is that I would have to rename 30 songs.
View 2 Replies
Jan 16, 2007
i have a movieclip called hero, which on every frame has a movieclip called 'mc', which in every frame has a mc called 'sword'problem is, on the first frame after i change frame (like from the idle animation to attack) 'mc' traces null, so i cant access 'sword' either, which is a bit of a problem for the design of the game...the frame after i change tho, 'mc' and 'sword' can both be accessed fine.
View 14 Replies
Oct 4, 2010
Having to do some as2 with an ancient system, and am far from fresh on it. I've managed to bungle my way through most of it, but I've hit a strange logic problem.
Code:
trace(this.firstChild.firstChild.firstChild);
trace(this.firstChild.firstChild.firstChild.nodeName);
trace(this.firstChild.firstChild.firstChild.nodeValue);
produces:
[Code]...
View 3 Replies
Feb 7, 2011
I've been trying to implement a QuadTree to store a two-dimensional array representing a terrain. I generate the array first, then I use the below function to generate a QuadTree for the array.
[Code]....
View 5 Replies
Sep 8, 2010
I have just recently started playing around with AS3 and am pretty new to what is going on in Flash (though I do have a lot of programming experience.) I have an object that I am dragging around on the mouse. I want it to be destroyed if I drop it anywhere but in a target location. I have the part where it is destroyed working, but I am running into a problem trying to find the target. When I try the following...
PHP Code:
public function DropObject(){
if (! this.hitTestObject(stage.getChildByName("Target"))){
stage.removeChild(droppedObject);
stage.removeEventListener(MouseEvent.MOUSE_MOVE,droppedObject.MouseCursorMove);
}}
I get "TypeError: Error #2007: Parameter hitTestObject must be non-null." So, "getChildByName" is returning null, but I'm not sure why. I've verified that there is an Instance name of the Target on the stage. Why can't I find it?
View 4 Replies
May 16, 2011
In the platform game I'm making, I have a movieclip level/stage with the platforms (which are there own class) added in. I'm trying to load those platforms into an array for future use, but as I keep on getting null. Take a look at the code:
package
{
public class StageLevel1Test extends StageManager
{
private var _platformListCntr:Number = 0;
[code]...
View 2 Replies
Sep 7, 2009
createClassObject returning null value when creating dynamic components. I am using the following code
[Code]...
this.mc is a movieclip which has the correct value during runtime but when i use createClassObject() with it its always returning null value.
I have the component dragged into my library. Also the code fails even when i am using mx.controls.Button instead of controls.PixtorieButton .
View 4 Replies
Sep 7, 2009
createClassObject returning null value when creating dynamic components.
I am using the following code
var __reg2 = new Object();
__reg2.label = _label;
__reg2._width = _w;
__reg2._height = _h;
[Code]....
this.mc is a movieclip which has the correct value during runtime but when i use createClassObject() with it its always returning null value.
I have the component dragged into my library.
Also the code fails even when i am using mx.controls.Button instead of controls.PixtorieButton .
View 0 Replies
Nov 5, 2009
I'm using the native Flash StyleSheet Object to hold externally loaded CSS styles, and when I run the the getStyle("myStyle") function of the StyleSheet Object, it returns an Object in all cases, even when the style doesn't exist!
In cases where no style is found on the StyleSheet, the ASDocs say that the getStyle() function should return null. So if "notAStyle" is not a style on the StyleSheet, and I test[code]...
View 0 Replies
Dec 23, 2011
I'm developing a Flex application using RobotLegs, LiveCycle DS & Java.I'm trying to implement an update function, using LCDS, but I'm running into some strange behaviour:This is the ActionScript code within a RobotLegs' execute command, used to perform the update:
var token:AsyncToken = services.requestService.commit(new Array(model.currentRequestDetail));
responder = new AsyncResponder(resultHandler, faultHandler, token);
[code].....
View 2 Replies
Oct 16, 2009
I have some confusions on root and the stage classes; like;When should I use root or the stage class, from within my custom classes, in order to access the existing objects on the main timeline.When is this.root == null or not!How can I check numChildren on the main timeline.
View 8 Replies
Jul 29, 2010
I continue, I must say I've searched on forum and on google and all the different kind of code didn't work On my actionscript panel, I have this:
import com.greensock.*;import flash.net.URLRequest;
import flash.display.Stage;import flash.display.LoaderInfo;
var sujet_no:String = LoaderInfo(this.root.loaderInfo).parameters["sujet_no"];var timer:String = LoaderInfo(this.root.loaderInfo).parameters["timer"];var back_url:String =
[Code]...
View 7 Replies
Nov 20, 2008
I have a main timeline with a button. I need the action for this button to gotoAndStop to a frame within a movieclip, within another movieclip. I have tried on the main timeline setting the actions of the button to:
on (release){
clip1.clip2.gotoAndStop("frame1");
}
and tried:
on (release){
_root.clip1.clip2.gotoAndStop("frame1");
}
lastly:
on (release){
_parent.clip1.clip2.gotoAndStop("frame1");
}
If I double-click on the movie clip (clip1) and then double-click on the movie clip (clip2), I have several frames labeled "frame1", "frame2", etc.The button doesn't work.
View 7 Replies
Feb 8, 2007
I have a movie clip on the stage and have given it the instance name "team1". inside this movie clip there are two states. at frame1 it says one thing, then at frame 10 has an image. team1 stops at frame 1 and what i want to do is when the main time line reaches say frame 50, i want the team1 movie clip to gotoAndStop at frame 10, thus showing the image and not the text. i tried doing it by putting this on the main timeline at frame 50: team1.gotoAndStop("team");
View 2 Replies
Apr 2, 2009
But I have ran into another snag. This is what I currently have: A MovieClip for the quiz. 10 more MovieClips one for each question. 2 buttons inside question (btnCheck and btnNext). 4 radio buttons to select then click btnCheck to check the answer. Then click btn Next to move to the next question. The functions inside the movie clips are setting the variables outside the question clips perfectly. What I want to do is to eliminate the btnCheck and have it check the answer when the radio button group is selected.
[Code]...
View 1 Replies
Jan 14, 2012
For some reason, the same code works now, without any problem at all. I don't know what happened, or why, but I no longer have this problem Here's the original post: To put simply, I created a MovieClip, put it with addChild() to stage, and when I tried to call this piece of code:
[Code]...
View 2 Replies
Jun 12, 2009
Is there a way to return the name of a movieclip which is being touched by the currently selected movieclip?I've got a variable called currentBall which is tracking a ball when placed inside a target zone (e.g. zone0_mc).How do I return the name of the target zone?
View 3 Replies
Jun 30, 2009
I am trying to return a movieClip to a project variable, so it can be retrieved outside of a function. However it fails.
I tried to simply set up a variable so when the function returns, it has a storage variable.
Then i tried for a function to retrieve the variable content
However when i call the trace(mc) it fails as undefined [code]...
View 1 Replies
Mar 24, 2010
Is there a way that I can obtain the name of a clip's children just like I can obtain the name of it's parent by using _parent?
Basically, I have a whole bunch of MovieClips that I have created through a function that parses an XML file. Basically, it's a custom-made Tree.
I have them all set up in their proper horizontal and vertical positions, but the one thing I'm having trouble doing is closing a branch on it. I've tried storing values in arrays to help me sort all the MovieClips on the Stage, but I must confess that I'm not good with arrays at all, so is there some sort of obscure function somewhere that can return the child clips, so I can do something like:
Code:
myMC.onRelease = function():Void {
if (myMC.hasChildMovies() == true)
for (var i:Number = 0; i < myMC.childMoviesArray.length; i++){
[Code]....
View 1 Replies
Dec 15, 2010
I´m working on a project and i want a button in a movieclip to link back to a frame in another movieclip when pressed.
View 1 Replies
Apr 23, 2010
How do you align a dynamic movie clip position with another movie clip which is in the root stage? I tried to get the mc in root x,y position, but the starting point of the class that loads the dynamic MC does not seems to be accurate. (Meaning at the root stage, the x,y is 0,0 but at the dynamic class, its somewhere like 100,20 for the browser area (and it actually vary base on the browser size))
**the other classes I used to run the custom classes below, I have it added this MC to stage
var blocker:stageBlocker=new stageBlocker();
this.stage.addChild(blocker);
Below is the dynamic MC. Should I not add it to its own "stage"?
public class stageBlocker extends MovieClip {
private var blocker:MovieClip= new MovieClip();
public function stageBlocker():void {
[Code].....
View 1 Replies
May 18, 2010
I need to load a swf in other domain and call its functions and access its variables, using the allow domain i have accessed the variables and functions. now i need to control the movieclip (other domain swf) using gotoAndStop(). i tried lot using gotoAndStop frame number or lable name it is not working. but i can able to trace the currentframe of a movieclip.
View 8 Replies
Jan 16, 2009
I made a movie clip or movements and what not and put it on scene1 frame 1. And when the movie clip end I want it to go to scene1 frame2. I tried a few things I have:
_root.gotoAndPlay(2);
Right now it says
1120: Access of undefined property _root.
View 6 Replies
Mar 20, 2011
I'm trying to construct a "getter" function in which a movieclip obtains it's childs current frame label, but for some reason I cannot get it to work.
Part of Block.as :
ActionScript Code:
public function getStatus(acs:String):String {
return (MovieClip(this.getChildByName(acs)).currentFrameLabel);[code]........
View 0 Replies
Jun 2, 2006
My question is that I have attached a movie clip using loadMovie() function.Now how do I perform functions on that movieClip such as gotoAndStop().In the sense how do I tell the movieclip to goto a frame?
View 2 Replies
Sep 7, 2010
I need to get my main swf A to tell the swf B (swfB is my scrollpane content or source) to gotoAndStop at frame 2 but it doesn't communicate.Here is my code on my main swfA:
Code:
function xbutton (e:MouseEvent):void {gotoAndStop("p1");MovieClip(sp.content).gotoAndStop(2);}
button.addEventListener (MouseEvent.CLICK, xbutton);
Here is my code on frame 2 in swfB:
Code:
stop();
SoundMixer.stopAll();
to better visualise what i am doing; swfA is my website with lots of pages, swfA has one page* that holds my scrollpane, inside my scrollpane is swfB with a flPlayback (*this page is the tv page). when I exit the tv page to another page on my website the tv must stop. swfB has my flPlayBack on frame 1, frame 2 is blank (no tv).
Ps: The code in swfB works fine independently! I know this because tested it by adding a button (when pressed it goes to frame 2 and the code does stop the tv).
View 1 Replies