ActionScript 2.0 :: Access Nested MC From Parent Class

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


Similar Posts:


ActionScript 3.0 :: Setting Properties Of Nested Clip From Document Class Of Parent

Aug 29, 2011

Setting properties of a nested clip from the associated document class of the parent clip. I am developing a Jigsaw puzzle in Flash. I am developing a class for puzzle piece. The code of the PuzzlePiece class in given as follows.

PuzzlePiece class
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class PuzzlePiece extends MovieClip {
private var pieceX:Number;
[Code] .....

Is it wrong to access it like that. The PuzzlePiece is the export for a puzzle clip. For the time being I am hard coding the dimension as 60. I have aloso uploaded the fla and as files. [URL].

View 4 Replies

ActionScript 3.0 :: Access Class From Nested Movie Clip?

Jan 28, 2010

I've instantiated a class on the main timeline where the stage is[code]...

View 6 Replies

ActionScript 3.0 :: Flash - Access Nested MCs From Main Document Class?

Mar 11, 2012

I have 3 dynamic textfields that are added to the stage through an external class, (I only add the main container from the Main.as) the textfields are nested under 5 MCs (that's what i see when i list objects in the debugger) how can i access those textfield from the Main document class?I've tried by path, by getchildbyname, i've exported the font for AS (the textfields have instance names)... and nothing works, i either get an error or it tells me it has no properties, or null..

View 14 Replies

Actionscript 3 :: Access A Parent Class In An OOP Correct Way

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

ActionScript 3.0 :: Can't Access Parent Class Variables

Feb 11, 2010

Look at this example [code]...

How come the trace in the SlotsSetup function is printing out NaN ?

View 1 Replies

ActionScript 3.0 :: Access Parent String From Sub Class?

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

Access Property Parent Class Protected Variable?

Aug 19, 2011

Assign an event listener to a protected timer variable in the parent class.

I am working with Adobe LCCS, and created a BatonProperty which implements Baton

Now, Baton has a protected timer variable declared like this, and for some reason, I am unable to get access to this _autoPutDownTimer, from a BatonProperty instance.[code]...

View 2 Replies

Actionscript 3.0 :: Access A Variable From Subclass Which Is In A Parent Class?

Oct 31, 2010

I want to access a variable from subclass which is in a parent class.Something like this:

class a extends b
{
private var a;
public function a()

[code]....

View 6 Replies

ActionScript 3.0 :: Access Vars In Parent.swf From Child.swf Class?

Aug 10, 2010

I cant access to var in parent movie from class in child.I have two swf's: parent.swf and child.swf. In parent.swf in frame 6 is:

Code:
stop();
var TestVar:String = "hello!";[code]....

I was trying use parent, parent.parent, parent.parent.parent etc. and any result - null object error.

View 2 Replies

ActionScript 1/2 :: Can't Access TextInput's Text From Inside The Parent Class

Sep 10, 2009

When I add a TextInput to the stage I can access it with instanceName.text. this works. Now I have one Movieclip with one TextInput inside (the textinput's instance name is testetxt). This MovieClip has a corresponding class and its code is the following:
 
class com.sck.testeT extends MovieClip
{
public var testetxt:MovieClip;

[Code]....

The textinput gets transparent but the text isn't changed... I realized it was because the textinput wasn't initialized yet. so I have to wait a while, but how can I know that it was initialized and I can set the initial text by code?

View 1 Replies

ActionScript 2.0 :: 'reverse' Inheritance - Parent Access The Properties Of A Child Class?

Feb 10, 2005

i've got an inheritance chain of AS2 classes set up where i have an array in the 'child' class that i'd like to be able to access from the 'parent' class:

bottomClass.as -'parent'
topClass.as -'child'

my question/dilemma is: how can the parent access the properties of a child class...is this even possible, or am i just looking at it wrong?

View 2 Replies

ActionScript 2.0 :: 'reverse' Inheritance - Parent Access The Properties Of A Child Class?

Feb 10, 2005

i've got an inheritance chain of AS2 classes set up where i have an array in the 'child' class that i'd like to be able to access from the 'parent' class:

bottomClass.as -'parent'
topClass.as -'child'

my question/dilemma is: how can the parent access the properties of a child class...is this even possible,

View 2 Replies

ActionScript 3.0 :: Access Child Text Field Through Parent Movie Clip's Class?

May 16, 2010

I have one movieclip object with a custom class.

That class has a loop that creates / instantiates a number of copies of another movieclip from the library. This second movieclip has a textfield child in it. When I convert this textfield to a movieclip I can access the properties of it fine, but just as a dynamic textbox I can't access it.

This is the custom class of the second movieclip that gets instatiated a few times by the first custom class...

This custom class relates to a movieclip that has a child MC called recent_text (which I can access ok) and in that child is another child (a dynamic text field called "aDynamicTextBox", which I can't access)[code]...

View 1 Replies

Actionscript :: Class Loaded Into Parent Class / Get Parent Variables

Apr 20, 2009

I have a child class that is loaded into the parent class when the swf begins, like so: var myvar = 'hello'; public function Parent() { this.child = new Child(); }; How can I retrieve the variable 'myvar' from within child?

View 1 Replies

ActionScript 3.0 :: Error 1120: Access Of Undefined Property Parent + Movieclip(parent)?

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

ActionScript 3.0 :: Nested Button Referencing Parent MC?

Dec 4, 2009

I am working on a tool for use in our office which creates XML. At this point I am working on getting an error message to appear when the user enters incorrect data in one of the textfields. I have a MC which contains my error message as well as a button. The button will move the MC back off of the stage. Everything works up to the point where I click the nested button. I suspect there is a problem in referencing the parent MC from the button.Here is the code for the entire project. I am sure there are more than a few errors since I am relatively new to AS

import fl.controls.RadioButtonGroup;
import flash.display.*;
load_file.addEventListener(MouseEvent.MOUSE_UP, do_load_file);//load file button click.

[code]........

View 0 Replies

ActionScript 2.0 :: Why Nested Button Will Not Move Its Parent

Jan 22, 2007

I have 2 child movieclips nested into one working parent movieclip, then the parent movieclip is animated. The nested working parent movieclip should move to the side once a child movieclip is clicked. Currently, the parent is unaffected by clicking on a child movieclip. What gives?

Below is a layout of the movieclip:
Button List Box
| |
v v
Subparent(groups btn and list box)
|
v
Parent(animated)

I need the parent to animate once the child Button is clicked.

View 4 Replies

ActionScript 3.0 :: Nested Parent Button Functions?

Jan 31, 2009

i have a nested swf that functions just fine.i have a parent swf (that holds the nested swf) that has a button (not related to functions of nested swf) that no longer works when combined.the button is simply a link button to a url... is there a very simple solution to this?

View 2 Replies

ActionScript 3.0 :: Nested Mc Button Calling Parent Function?

Jul 9, 2009

I have setup a video interface with a stock video player in the parent mc. In the same swf next to the player, I have a mc which is a video thumbnail chooser. The thumbnail buttons are located two levels down within this mc (nested within two mc) in order to facilitate the scrolling independent of the player. In the parent, where the video player lives, I placed a function:

function vid1(event:MouseEvent): void{
pubPlayer.source = 'Steve480.flv';
}

In the child mc where the thumbnail buttons are, I want to call the parent function like this:

vid1_btn.addEventListener(MouseEvent.CLICK, vid1);

None of my clips are externally loaded, just nested in the same swf. How can I talk up or down the movieclip ladder?

View 0 Replies

Actionscript 3.0 :: Nested Mc Button Calling Parent Function

Jul 9, 2009

I have setup a video interface with a stock video player in the parent mc. In the same swf next to the player, I have a mc which is a video thumbnail chooser. The thumbnail buttons are located two levels down within this mc (nested within two mc) in order to facilitate the scrolling independent of the player. In the parent, where the video player lives, I placed a function:

function vid1(event:MouseEvent): void{
pubPlayer.source = 'Steve480.flv';
}

In the child mc where the thumbnail buttons are, I want to call the parent function like this:

vid1_btn.addEventListener(MouseEvent.CLICK, vid1);

None of my clips are externally loaded, just nested in the same swf. How can I talk up or down the movieclip ladder?

View 2 Replies

ActionScript 3.0 :: Nested Child Calling Root Parent Function ?

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

ActionScript 2.0 :: Parent / Child MovieClip - Nested Frames And GotoAndStop

Dec 2, 2011

I have a very specific AS2 parent/child movie clip issue. I have a main Character movie clip which contains as nested frames each profile of the Character (front,back,left,etc). Within each of these child profile MC frames, animations for those profiles are further nested in frames. Then, essentially I have movement code as part of the key listener:

Code:
switch(Key.getCode()){
case 87:
Character._y -= 10;
Character.gotoAndStop('Back');
Character.gotoAndStop('walk');
break;
[Code] .....

And later code to reset to the character's resting frame after key release:
Code:
switch(Character._currentFrame){
case 5:
Character.gotoAndStop('Back');
break;
[Code] .....

The problem is that when I try to Character.gotoAndStop('Front'); after key release, flash thinks, you're already on the Front frame (because the walk animation is a child of that MC and is already playing). Therefore the walk animation just keeps playing after the key has been released.

View 1 Replies

Flash :: Find The Parent Of A Deep-nested Sprite From The Stage?

Jan 21, 2011

I'll give a complete explanation of what I'm trying to do. I have a video player as a separate SWF. In this video player I have a VideoContainer class extending Sprite, which contains the video and a control bar with specific video buttons.

This SWF is loaded in another main SWF, which has a menu that is on top of everything else. When I click "Fullscreen" in the video SWF, everything goes smoothly, except the menu remains on top of the VideoContainer object.

I need a way to change the display order of the loaded SWF, to put it on top of everything else on Fullscreen and change it back when Fullscreen goes off. All this needs to be made inside the video player. Also, the configuration of the children can change (the video player can be loaded in different places in the main SWF), so I can't use a certain unchanging path.

View 2 Replies

Flash - Nested Animated Symbols With Child Longer Than Parent?

Jan 12, 2012

I'm looking to create an animation loop in Flash. The base character animation I have is 27 frames. However to have the background move at the correct speed, the entire animation is 432 frames.

Since I am making the animation so long anyway, I want the character to blink halfway through the animation loop. I went into the head symbol and extended its animation from a single frame to 432 frames. Halfway through that animation I swap out the image for one that is blinking (3 new images added for the blink).

So, now the symbols are nested like: 432 frames -> 27 frames -> 432 frames

But it doesn't seem like Flash is smart enough to animate it as I would expect. It only repeats the first 27 frames of the child symbol.

The next thing I tried was extending the 27 frame character animation out to 432 frames. I did this by copy-pasting the character animation 16 times. But this also does not work because copying the keyframes also copies the position of the child animation's playback. This causes the animation to constantly reset and never reach the blink.

I also tried using the copy motion option, but it didn't seem to do anything different than copying keyframes.Is there an easy way to make this animation work? I can't possibly need to manually position a total of 576 keyframes (there is actually another level to the nesting which does not use any tweens, just keyframes) could I?

View 1 Replies

Flex :: Get The Item Parent In A Tree When Using Nested Objects As Data Provider?

Jan 11, 2010

I have a Flex tree with an ArrayCollection as data provider. The collection holds an array of CategoryVO objects. Each object can have another array of CategoryVO objects inside it's "child" attribute. This way the tree displays the data correctly. Now I want to get the parent of a specific item, e.g. tree.selectedItem. Using XML as data provider the item parent is avaiable thorugh the parent() method. But I can't convert my data to XML. How can I get an item's parent? Perphaps using the tree's dataDescriptor?

View 2 Replies

Nested Textboxes Access?

Jan 29, 2010

i have a textbox (totaltxt) within a movieclip (link_mc) which is on frame1, and i am trying to access the contents of totaltxt and put it in another textbox called totalround1 in frame2...e.g. if totaltxt = 100 then totalround1 should equal 100 aswellthis is my failed attempt:PHP Code:totalround1.text = Number(link_mc.totaltxt.text);

View 1 Replies

XML :: How To Access Nested Arrays In AS3

Feb 24, 2011

I am having problem with 2d nested arrays, I want to create one which is coming from XML. My XML ('test.xml') looks like this:

<content>
<item image="Mike.jpg" name="Mike" state = "New York">
<complex fid = "0"> ju675</complex>
<complex fid = "1"> kyu49</complex>
</item>
[Code] .....

View 1 Replies

Actionscript 3 :: Dispatching Events From Parent Class To Child Class

Apr 30, 2010

I think this is a pretty simply problem but I do not seem to be able to pull it off. Basically I have a parent class A, and a child class B.Class A instantiates class B with addChild.There is a shared object which is being updated from a java server (red5) that has an event listener attached to it in class A.I have a function in class A which will pass certain, specific updates from this shared object to class B.The problem occurs is that when class B is instantiated, the event listener from class A doesn't work anymore. I have not removed the event listener from A.?

View 1 Replies

ActionScript 3.0 :: Calling Method In Parent Class From Imported Class?

Jul 15, 2011

I have the following parent class that I'm working with:

Code:
package {
import com.poptent.SubClassOne;
import com.poptent.SubClassTwo;

[Code].....

I am trying to set it up so that a parent method called by subClassOneInstance can affect subClassTwoInstance.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved