I am trying to run a function of the main class, but even with casting it does not work. I get this error
TypeError: Error #1009: Cannot access a property or method of a null object reference. at rpflash.communication::RPXMLReader/updateplaylist() at rpflash.communication::RPXMLReader/dataHandler()
So I am trying to access a variable that is defined within my parent code from a class which has been called from my parent code. I am using this:Code:TileCode(parent).game_quests.add_quest(0);to try to access the game_quests variable (which is defined within TileCode). However, for some reason it is not picking that up. It is working for other variables which I have called and ran in a similar fashion
I have this question and need for your opinion. Im new to AS3.I have 2 movieclip.. there are stage1_mc and stage2_mc.When the stage1_mc hit the last frame, there will be coding put in last frame to ask stage2_mc to start playing.
AS2: // coding put in stage1_mc last frame stop();
I'm trying to reference a specific frame inside a MC in my .swf file from an .as file.What I want is to capture the current frame of the movie clip for the .as file. It's for the purpose of points when you shoot each plane. It's an easy trick of frame 1's plane would be worth 100 points, frame 2's plane 200 points, etc.I thought I'd write a line like this in my collision detection section of my .as file.
Code: planePoints = currentFrame * 100;
The only problem is, of course, it grabs the current frame of the main .swf timeline that my flash file uses, and not the movieclip that's being called to produce the planes.So I thought I'd be able to specify a path to the movie clip (in this case it's called Airplane in the MC's linkage properties)
Code: planePoints = Airplane.currentFrame * 100; Then, of course, it freaks out and says that 'access of possibly undefined property currentFrame through a reference with static type Class.'
I still get confused with AS3 and the way items are handled vs AS2. I've lost track of how many times I type _root.
I wonder what the most common reasons for memory leaks in AS3 are.First thing what I am not sure about is: is it better to have a variable reference inside a function or outside it. Will the variable be null-d automaticly inside a function or when do I have to null it and when not?I have massive problems with my game with memory leaks. I noticed I reference some of the clips of the timeline even inside my debugging clip to display propertys and this was causing collecting huge amount of memory.But even before I go into the game with bigger objects the System.memory is slowly growing and growing.I just have a socket connection and some interval loops and enter_frame events.
there is a movieclip named movie with instance name movie.Inside this movie there is a textbox in frame 1.I want to give properties and methods to that textbox.
yourbutton.addEventListener(MouseEvent.CLICK,f); function f(e:Event):void{ Loader(this.parent).load(new URLRequest("newswf.swf")); }
which was suggested to me in a different post to target the parent loader class, however i now no longer can reference my preloader in the parent swf (extract from the parent swf):
I cannot use the following in my ActionScript due to conflicts with the host application:
_level0 _root _parent references
On a pop-up box I have a close button with an absolute reference: closeBtn.onRelease = function{ unloadMovie("_level0.Page_1.holderBox");} Is there another way to make this work without using _level0 or _parent? I've read that it is possible to use a global variable on the main timeline and ref that, but cannot get that to work.
I have a movie clip on the stage which contains 4 frames and i wanna call a function from for example frame number 4... Obviously i wanna call this function from the main timeline containing all the MC. How can i do that, i have been looking around but cannot find much...
is there any way I can link a button inside a MC on frame1 to a frame inside another MC that is located on another frame.Ive got 2 frames in total. On the first frame Ive got an Mc and inside this one Ive got a button that needs to be linked to frame number 50 which is inside a MC located on frame number 2.
I have a site class with different properties. The site class creates a Background class. I want the background class to use the Site class' stylesheet object. How can this be done?At first I thought about passing the site object to the Background class' constructor, but maybe there is a way to reference to the calling class?
I'm creating a bunch of movieclips, associating a sound object with them, and then updating them with a progress bar, like so:
var theClip:MovieClip = new MovieClip; theClip.track = new Sound; [load sound from URL pseudocode here] theClip.track.addEventListener (ProgressEvent.PROGRESS, onLoadProgress); function onLoadProgress (erogressEvent):void {
How do I reference the movieClip the sound is a child of? e.target refers to the sound object; e.target.parent returns an error. And you can't assign properties to sound objects.
I am writing some codes inside a movieclip but I want to activate a mouse over event from a parent object since there is a removeEventListener method that delete the the event!Is there a way to do it in actionscript 3.0?
I'm trying to create a timer object within a movieclip, which, due to the dynamic nature of the movieclips, works well. However, when a timed function is kicked off I'm having trouble referencing the 'parent' movieclip.I'm trying the code below but the'Evt.currentTarget.parent' line throws an error. Anyone know how to make that reference work?
var mc:MovieClip = new MovieClip(); mc.transitionTimer = new Timer(30, 0); mc.transitionTimer.addEventListener("timer", stepTransition);
I am wondering how to correctly reference child/parent movie clips when creating event handlers? I have a button within a movie clip, which is within a movie clip.This is what my handler looks like right now:
The button instance name is ButtonSeats Problem is, I get this:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
Also, if I were to move the vent listener directly into the movie clip where the button is located, how could I reference the parent/ parent timeline(the main timeline)? Am I correct to understand that .this refers only to the current clip?
I'm having bit of a headache with 1119 error and I can't figure out why.The problematic line is in red.
What I'm trying to do is:
1. Add Display Object "imagesGallery" to mainWin 2. Add MovieClip "imagesPreloader" to "imagesGallery" 3. Fire the "load" function from "imagesListLoader" which should fireup the function imagesLoaded in "imagesGallery"
I have a flash code where i am loading an AS 2 SWF inside AS 3. The thing is if i put the AS 2 SWF on same domain its working fine but if i put AS 2 SWF on different domain it loads the SWF properly but the "stop()" written inside the AS 2 frame doesnt work... and it keeps on playing all the frames continuously...
I have done this same thing in ActionScript 3, but am not familiar with ActionScript 2, which I am forced to use for this project. I am loading products into a SWF via XML and attempting to add a click event to each dynamically-created movieclip. Simply tracing the text from a node in XML will do for now. I'd like to assign a property called "desc" or "description" to each movieclip and have it trace that property's value when clicked. Here is the relevant portion of my code as it stands:
ActionScript Code: var iXML:XML = new XML(); iXML.ignoreWhite = true;
Recently I worked in a project using Flex. Its a Photo editing project. I have took a Canvas and take a image in that canvas using the code canvas.addChild(image) . Now i can move the image freely by using moving code. The image move inside the canvas and outside the canvas. I want to move the image/child only inside the canvas not outside. How can i do this?
I have recently experienced problems with attempt to remove DisplayObjects that were placed at design time.I have some class "Locator" inherited from Sprite. Several instances of it are placed at the stage at design time.Locator constructor fills parent variables and tries to remove the instance itself from parent:
ActionScript Code: public function Locator() { // give parent some important data
[code]....
All instances now process constructor, but only one of them processes event handler.
draw a shape on the stage, make it into a movieclip, registration point wherever, tl is fine, name it mc, and put his code:
trace(mc.getChildAt(0).y);
now get inside a movieclip and move that shape around (away from registration point) for example above registration point, or wherever and output will always be 0.
stop(); this.addEventListener(MouseEvent.MOUSE_DOWN, active); function active (e:MouseEvent):void { this.gotoAndStop(2);
[Code]....
this is adding mem1 to the parent,
now on the next frame i want to remove that movieclip, how would i go about doing this. i tried just putting MovieClip(parent).removeChild(mem1); but it says accessing undefined property
I've looked all over the web, including this forum and can't seem to find a solution to my problem. I have the following:A main movie (root) that loads external swf files as needed. These external swf files have movieclips within them I want to reference. So I have the following code in the main movie (root).[code]Everything up to the point of tracing through the loaded movieclip works fine. When the movie is tested, it does not seem to want to trace through all child information of the loaded movieclip.Essentially I'm doing this to see what is inside the loaded movieclips (though I know 'cause I can look at the fla file); however I need actionscript to be able to see into the loaded movieclips so that I can adjust another movieclip within the loaded movieclip as necessary.