ActionScript 2.0 :: How To Access A Parent Movieclip
Jun 29, 2009
How can i access the parent movieclip,namely "blocker_mc" here, in the codes as follows:
ActionScript Code:
keyListener.onKeyDown = function() {
trace(this._parent) // output: undefined
}
I have a solution that i dont think so good.Solution:create a variable, also a new property, to store the "address" of the parent movieclip like
[Code]...
View 4 Replies
Similar Posts:
Mar 15, 2011
I am trying to access a function that is on my document class for my AS3 project, from a nested class. That is, the Document Class calls Class A which then calls Class B. So I am trying to access a function from Class B, I am trying to use MovieClip(parent).function(); but I am getting error 1120. The MovieClip(parent) (fixed to reflect my document class, etc) works when I try it from other classes but not from this nested class.
View 9 Replies
May 12, 2010
I have a function that loads the movieclips from the library[code]...
But i CAN'T access the timeline where the code is from the instantiated movieclip (obj, obj2, whatever it is);
inside "apresentacao" movieclip I've tried to trace the parent and i get NULL.
View 3 Replies
Dec 10, 2009
I've struggled with this for a long time and have thrown in the towel. How the heck do you climb the ladder, then go back down again into another clip?
View 2 Replies
Jul 3, 2009
I have created an renderer to modify the content of one of the columns of the DataGrid.
Code:
package {
import fl.containers.UILoader;
import fl.controls.listClasses.ICellRenderer;[code].....
but how can i access the parent DataGrid or anything outside of this class ? In Java it can be done, but how can i pass any value to this class.My use case is that i click on a delete button and the row is deleted, impossible to do if i cannot access the parent DataGrid and call methods to work with it.
View 4 Replies
Aug 24, 2009
I have an SWF file that loads another SWF file dynamically.
I've managed to make the parent SWF receive a variable from the php page that loads it, via javascript, it works well [code]...
View 1 Replies
Feb 3, 2010
I have a movieclip that has everything for my flash program inside of it. Its called Main, sitting on the root timeline. I have some code within Main, and I am trying to get it so that I can gotoAndPlay a frame outside of Main (further down the root timeline than where Main is sitting. How can this be done?
View 2 Replies
Aug 15, 2010
imagine that i have index.swf .on the first frame of it the main.swf will load .now i want to go to next frame of index.swf ( that contain action code for loading some other swf file ) from main.swf by clicking on a movieClip .how can i access to index.swf form main.swf ?
View 1 Replies
Oct 5, 2005
Well- actually, my problem is a bit more abstract than this thread's title suggests..ere's the setup:I have a parent function (called "Game") with a couple of subfunctions.There is one subfunction ("Game.prototype.spawnBonus") that, as the name suggests, spawns a Bonus Item by duplicating a movieclip.The duplicate movieclip is created on "_root"-level and has an onEnterFrame attached to it that checks whether a certain stage is met (all this works).Now the problem is, when the case is met, I need to access a subfunction of "Game" and pass it the MC's ID to fade out the Bonus Item. Like so:[AS]Game.prototype.fadeBonus =
function(number) {
// just some stuff to fade out the MC with the number
// passed through the value "number". This works well,
[code].....
View 3 Replies
Jul 22, 2009
I have a container with text and a button and an image.
When i Mouse over the button i want to be able to tell the text inside the container to change its TextFormat to another.
How do i tell the text to do so, i though it would be something within the MouseEvent like,
event.target.parent (someway to access other child).setTextFormat()
is their a simple way to access another child from within the same parent?
View 4 Replies
Oct 24, 2010
I have movieclip which contains child movieclip. when child movie clip finish to play i want to run a function in a parent movieclip. so I made a custom event dispatcher in the first frame of the child movieclip:
[Code]...
View 4 Replies
Jun 1, 2010
i am using a movieclip who has two nested movieclips, the problem i am dealing is that when i try to get the width or height of the parent movieclip it always showing the values of the small nested movieclip, when i draw the movieclip it draw perfect but when i read this values shows that error, what can i do?
View 2 Replies
Jun 17, 2009
I have main screen that has Loader to load SWF files. Within these SWF files there is also Loader that loads SWF files.
[Code].....
View 4 Replies
Jun 25, 2009
I want to load an external swf movie into the parent one using for example the UILoader component and I want it to have access only to one object of the parent (the main swf movie). I tried sth like my_uiloader.content.parent = null, but obviously it doesn't work as the parent property is read-only.
View 15 Replies
Mar 11, 2012
I just started programming OOP and I'm running into a scope problem. In the following project, I have a masterClass called App. The App-class has Screens:Screen-class and a Navigation-class as it's children. From the navigation class I want to control which screens will be displayed. I don't know how to do this.
[Code]...
View 2 Replies
Feb 25, 2008
i was caught in the situation that i need the DisplayObject to access its parent.variable.
I have a Loader"B" was inside MovieClip"A"(with a variable"v") and i want called A.v like this:
Code:
trace(B.parent.v);
the above code is not working. and I need something similar. is it possible??
by the way, it has to be dynamic because i need to use it with function:
Code:
function doSomething (d:DisplayObject):void
{
trace(d.parent.v);
[Code].....
View 4 Replies
Dec 22, 2008
I have to access a function in child swf from parent swf. This child swf gets loaded into a canvas object in parent.swf. Everything works fine but I'm unable to call any function that was in child.swf. My code is
Code:
var swf1:SWFLoader = new SWFLoader();
swf1.source = "CHILD.swf";
can.addchild(swf1);
I read on google and then I tried this in parent.swf's code
Code:
var myrequest:URLRequest = new URLRequest("CHILD.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);
canvas.addchild(myloader);
Now this one throws up a runtime error TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@5934b01 to mx.core.IUIComponent.
I also tried this
Code:
var myrequest:URLRequest = new URLRequest("CHILD.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);
[Code]....
But in this case my swf does not show up at all and there are no runtime errors too!
How do I resolve this error and how do I then access the function in child.swf?
View 9 Replies
Jan 15, 2010
Ok im rather new to flash so ill do best i can to describe this. I have a HealthBar movie clip with 3 layers, bottom layer is just a red rectangle, middle layer is a green rectangle that is a movie clip, and the top layer is just a border. the green rectangle movie clip has an instance name of bar. i put my HealthBar on my stage with an instance name of healthBar and i change it when the players health goes down by calling _root.healthBar.bar._xscale = health where health is 0-100.
this works all fine and dandy. now i have a movie clip of MiniBoss with an instance name of miniBoss# where # is a number of the layer depth when it is created. in the MiniBoss movie clip i have an instance of the HealthBar with an instance name of bossHealthBar. i tried to call from within the MiniBoss class bossHealthBar.bar._xscale = health but i get an error that there is no property of bossHealthBar.bar._xscale. how do i access the bar in the HealthBar in the MiniBoss clip from the MiniBoss class in its onEnterFrame() method?
View 2 Replies
Feb 11, 2010
Look at this example [code]...
How come the trace in the SlotsSetup function is printing out NaN ?
View 1 Replies
Jul 11, 2010
I have a Main class that has a public var "foo" which is a string. my subClass is a movi clip that has a text field called txt. I want to access the document variable from the sub class but get error 1119: Access of possibly undefined property foo through a reference with static type flash.displayisplayObjectContainer.[code]...
View 5 Replies
Jun 21, 2008
The external swf is located at:[url]....In the parent.swf, I put System.security.allowDomain(url....)When you click a button on the child.swf it's suppose to trace data from the parent.swf, but it returns undefined.What am I doing wrong? I MUST access data from the parent.swf
View 4 Replies
Nov 12, 2009
can't figure out why "parent" would be an undefined property.. this is a compiler error, not run-time:
Code:
override protected function fire():void {
var startX:Number = MovieClip(parent).x + (MovieClip(parent).width/2);
var startY:Number = MovieClip(parent).y + (MovieClip(parent).height/2);
var bullet:Bullet = new BlasterBullet(_stage, startX, startY, _firingSpeed, _firingStrength);
}
View 3 Replies
Jan 12, 2010
I am getting the following error:1119:Access of possibly undefined property through a reference with static type TenI am explicitly casting, and tried this.parent and still get the same error. What am I doing wrong.
Here is the code:
package
{ import flash.display.*;
[code]....
View 7 Replies
Mar 15, 2012
I have load child swf in parent swf, from child swf i am trying to run my parent swffunction I am trying this code
MovieClip(parent).testfun()
but this code is giving error.
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@2b1aa061
[code].....
View 1 Replies
Mar 12, 2011
below shows how to add child in a movieclip. ebd.target.addChild(info_grd); there is button named my_btn inside the movieclip info_grd.I would like to remove movieclip info_grd.parent
View 2 Replies
Jul 7, 2011
Access parent child nodes and attributes in XML?[code]...
View 1 Replies
Apr 13, 2012
this is so embaresing and my whole business is suffering from this[URL].. the key point in my TextArea class which extends TextField is to load external swf files and I use the .parent property of the Loader class to access the textfield... with the new security updates coming with 11.2 I cannot access the parent and the whole thing crashes to give you more insight:
imagine that we have file.swf being loaded into the project using the flash.display.Loader class. from the document class of file.swf, I can access the loader like this, all ok till here _loader = this.parent as Loader
[Code]...
every day that one of my clients updates their player to the new version, their website fails. I need to fix this a.s.a.p.
View 3 Replies
Feb 2, 2010
Inspired by this Flex question, is it seen as better practice to dispatch an event back to the parent app, as opposed to calling a method on the instance of the parent app, from within a module? To me it seems that the module shouldn't know what methods are available at the parent, as such approach leads to tight coupling.
View 1 Replies
Sep 18, 2010
I have a public variable set within fx:Script tags in a parent component that I'd like to access directly from a child component. How can I do this? I don't want to pass the variable to the child component (I know how to do this and am currently using this approach). Following is a simplified version of the mxml:
Note: SimpleComp is an HBox with a couple of lists.
<mx:Accordion>
<comp:SimpleComp/>
</mx:Accordion>
View 4 Replies
May 24, 2011
How to access variable of parent movie clip in child movie clip in Action script 3.0
View 1 Replies