ActionScript 3.0 :: Referring To "parent" MovieClip In A Nested MC

Apr 12, 2011

I have a nested movieclip, which I shall refer to as Menu.a.b This is passed to a MouseEvent function using e.currentTarget

I now need to run a command (indexOf) on Menu.a, however only have Menu.a.b saved. How can I refer to Menu.a as a function of Menu.a.b

I've tried Menu.a.b.parent, and that hasn't seemed to work, nor has a few other attempts involving the MC function.

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Get The Width Or Height Of The Parent Movieclip It Always Showing The Values Of The Small Nested Movieclip

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

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

ActionScript 3.0 :: Referring To Nested Sprites

Jun 3, 2011

What I am basically trying to do is Like,the yellow boxes are dynamically made,with Actionscript Code: new Sprite(); inside that red and blue are also made with new sprite(); with instance names yellow1(red1,blue10),yellow2(red2,blue2) etc... How can I refer to yellow1.red1?Like,these are dynamically made,and i dont know the limit,like say it adds on with each click,It will make Actionscript Code: 'yellow'+i and red+i etc... How can I refer to the ith sprite when the user clicks?Suppose the user clicks yellow5,I want a reusable code that will refer to yellow5.red5

View 1 Replies

ActionScript 3.0 :: Referring To Nested Items?

Mar 15, 2009

I must be doing something very stupid here. I have a tab-based menu that has different states for different purposes. I store these states in an Array and have a function I can call when I need the menu to change, which works fine.

But what I cannot at all understand right now is how to access the elements inside the newly create tabs (to add EventListeners for example).

[Code]...

View 4 Replies

ActionScript 3.0 :: Referring To A UILoader In Parent?

Oct 12, 2010

I have a button nested in a moveiclip within a larger flash file. I'm trying to have the button launch another swf file in a UILoader that is nested in the parent of this movieclipI thought that the following code would work to refer to a UILoader in a parent movieclip, but it didn't

archGallery.addEventListener(MouseEvent.CLICK, goArch)
function goArch(e:MouseEvent):void {
loadWindow.(this.parent).source = "archGlider.swf"

[code].....

View 5 Replies

Actionscript 3 :: Flash Referring To Parent Variables With Child?

Oct 31, 2011

I'm having some trouble getting to grips with how a child can refer to the variables of parents. Here is my Main.as :

package
{
import flash.display.MovieClip;
public class Main extends MovieClip

[code]....

Using trace(MovieClip(parent).i) instead I get:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Child()
at Main()

View 2 Replies

Actionscript 3.0 :: Referring To Variables In Parent MC In Multiple Child MC's?

Nov 7, 2010

I have several .as files. The first that loads is Main.as;

package
{
import flash.display.MovieClip;
public class Main extends MovieClip
{

[code]....

So this MC gives the user the ability to type in their name and store it into the parents playerName variable. With the intention that I can refer to it at any point later in any other MC. It stores it okay, a trace proves that, but a problem comes when this movieclip is replaced by the new one ZoneSelector;

package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;

[code]....

As you can see, there's hardly anything in the this .as file. But everytime the trace(MovieClip(parent).playerName) tries to run I get the following error;

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ZoneSelector()
at Setup/onbeginGameButtonClick()

It's as if the ZoneSelector runs its entire script before the playerName is set..or something like that.

View 7 Replies

ActionScript 3.0 :: Referring To A Movieclip?

Nov 23, 2009

i need to refere to a whole bunch of mc named a1, a2, a3, a4, a5 and var who:MovieClip="a"+3 dosnt work...

ActionScript Code:
import gs.TweenLite;
stop()[code].............

View 1 Replies

ActionScript 2.0 :: Referring To A Movieclip?

Feb 7, 2006

Code:
var l = 2;
duplicateMovieClip(button, "button"+l, this.getNextHighestDepth());

[code].....

View 4 Replies

ActionScript 3.0 :: Referring To Movieclip Within Object?

Mar 4, 2010

I have an object that I add movieclips into when a user does something.

I'm trying to loop through the items in this object later and perform something when object.objectName = something, however I'm finding it hard to get the right code to use in place of the something.

code within a function that adds movieclip to object:

Code:
if (thisHImage==1) {
healthArray[healthIndex] = new mcCake();
}

[Code]...

when i trace(healthO.objectName) i get [object mcCake], but it won't enter the if statement,

View 2 Replies

ActionScript 3.0 :: Referring To A Frame In A Different Movieclip?

Jul 8, 2009

I have a button located in a movieclip which I want in its overstate to gotoAndStop a particular labeled frame located in a different movieclip. How do I go to a frame of "movieclip A" by interacting with an element of "movieclip B"? Must I sever the relationship between the button and the movieclip its in which I wouldn't want to do...?

View 3 Replies

ActionScript 3.0 :: Referring To Functions On The Stage From A Movieclip?

Mar 2, 2010

I just started "coding" in AS3. By "coding", I actually mean trying around with features and generally trying to grasp the vast amount stuff you can do with this software of. I have some coding experience, however the way  Flash likes to hide code snippets all over my project does tend to confuse me. Not knowing where I tried putting the code and/or rewrote some other stuff keeps me sorta busy.
 
Anyway, my issue is this:
 
Messing around with movieclips inside movieclips, I've keep encountering the error "1120: Access of undefined property onTimerComplete." I do realize that this error generally is caused by not having defined an instance correctly or not having it defined at all - an error beginners tend to make. Nonetheless, I'm not trying to refer to an instance/symbol, I am trying to call a function defined on the stage from within a movieclip that also is placed on the stage.

I've been reading huge amounts of text/articles and how-to 's, but they all seem to only touch the subject lightly or simply going in head-first - becoming far too complicated for me (a beginner) to grasp.
 
So, trying to sum my questions up into something that looks like a tl;dr:
 
- What's up with levels, "_root" and referring to functions like in the older versions of flash?

Flash tells me to use some display-package instead of _root, when I use that... (I do realize the article is from Flash 5.0)
 
- How do you refer to a function defined on the stage, from inside a movieclip? (The function is a timer, that is supposed to make the mother-movieclip continue to the next child-movieclip.)

View 7 Replies

ActionScript 3.0 :: MovieClip Buttons Referring To Main Timeline?

Sep 1, 2009

I've got what I think isn't a real tough one however I can't seem to get this working.
 
I have a MovieClip. This movie clip has 21 buttons. These 21 buttons should be forwarding the user to frames 60-81 on the maintime line.
 
The actionscript I've added is not providing any errors however it's working either as these buttons don't do anything unfortuanlty.
 
Below is a sample of the code i've placed within the MovieClip itself, as the buttons and the button names are contained in the movieClip.
 
AS3 Code Being Used

button1_btn.addEventListener(MouseEvent.CLICK, button1Click);function button1Click(e:MouseEvent):void{    gotoAndStop(55)}
 
This code is listed for each button instance and to forward the user to a frame on the main timeline (NOT the timeline in the MovieClip itself).
 
Again, this code is contained in the MovieClip itself and not on the main timeline, as the buttons exist in the movieClip I.E. button1_btn to button21_btn
 
Lastly, to provide a visual idea of what i'm expereincing, please refer to screenshot embeeded in this message or the attachment (same thing).

View 4 Replies

ActionScript 3.0 :: Flash Referring To Movieclip In Array Using Names?

May 1, 2011

I am writing a program where I have used multiple movieclips (boxes) that are put into a grid using a nested for loop.

Each movieclip is in an array and I want to give them names (box1, box2, e.t.c) but when I try to trace() them i get this in the output: "[object gridBox]".

[Code]...

View 4 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 :: 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

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 :: 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 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 :: Parent.parent.movieClip.visible = False; - How The Heck Do Climb The Ladder Then Go Back Down Again Into Another Clip

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

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

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

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 2.0 :: Apply Actions To A MovieClip Nested Inside A Dynamically Attached MovieClip - Remove Clip

Dec 4, 2011

I want to apply actions to a movieClip nested inside a dynamicly attached movieClip, with the attachMovie method; it doesn't works when the movieClip is attached by a button:

1.when the swf movie loads with an attachMovie method the remove_btn clears the window_mc

[Code]....

View 9 Replies

Actionscript 3 :: Cleaning Nested Dynamic MovieClip(Class) In A MovieClip?

Nov 14, 2011

I'm trying to do a cleaning of some classes that is added into a MovieClip, but I can't seems to set the MovieClip(Class) to null. What is the proper way to do it?

private var mcHolder:MovieClip = new MovieClip()[code].................

View 1 Replies







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