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


Similar Posts:


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 "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

ActionScript 3.0 :: Positioning Parent MC In Order To Center Child MC On Parent's Parent MC

Feb 5, 2010

[code]All clips are squared.Ok, on the PlayerPlane, there are little soldiers, which have hotkeys. The effect I'm trying to create is I want to position the GameStage so that the currently selected soldier appears in the center of the GameClicker clip.The GameStage is movable by the player (to scan other areas of the map)by holding the CTRL key, so it's easy to kinda lose track of where your players are.I have tried using localTo Global and globalToLocal techniques, but I think I'm lost on the actual math of getting the GameStage to move the correct distance so that the selected soldier is centered to the GameClicker.[code]

View 2 Replies

ActionScript 3.0 :: Remove Parent.parent.parent Child?

Jan 3, 2010

I got a "preloader" that creates an movieclip and loads an SWF. Now in the loaded SWF i want a close button to go back to the "preloader". The preloader isn't an actuall preloader but some sort of mainclip.Now i tried this:removeChild(MovieClip(e.currentTarget).parent.pare nt.parent)But i get error:ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.at flash.display::DisplayObjectContainer/removeChild()at MethodInfo-6()

View 1 Replies

ActionScript 3.0 :: Referencing Stage - Add Bullets To The Stage Rather Than Using Parent.parent.parent.addChild?

Jul 10, 2009

I'm currently making a platform game and when the player shoots i want to add the bullets to the stage. The players gun class is in charge of adding bullets. The "players gun" is a child of "players gun holder" which is a child of "player" which is a child of the stage. is there a better or more dynamic way for the "players gun" to add bullets to the stage rather than using parent.parent.parent.addChild (bullet);

View 2 Replies

ActionScript 2.0 :: Referring To URL In XML?

Dec 21, 2006

This is my problem: I've got a couple of movieclips, when I click on them I want them to open the URL that I've typed in my XML-file.(The photos are thumbnails stored inside of the movieclips)Here's my XML:

Code:
<?xml version="1.0"?>
<select name="photos">
<option photo="film14" url =">[code]....

How do I refer to the url-code in the actionsscript?

View 4 Replies

Professional :: CS4 Referring To A Label

Feb 20, 2010

Now that I've set labels, I'm trying to create actionscript code to go to the labels. Here's an example of my code:
 
btn_me.addEventListener(MouseEvent.CLICK, gotome);
function gotome(event:MouseEvent):void{    gotoAndPlay(me);}
 
This code has been borrowed from the online video - Getting Started 18: Building an Application. Of course, in that video explicit frame numbers are used so the code looks like gotoAndPlay(15). I'd prefer to use labels for obvious reasons. My question - how do I tell Flash that 'me' is a label? I expect I need to use a special character and I've already tried gotoAndPlay(#me) but that gives me a Syntax error.

View 3 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 Another Object?

Apr 12, 2010

I have a small Flash file where I control a ball.In ActionScript 2.0, I have it to where this ball moves around based on input from the Arrows on the keyboard. It also bounces off the edges.I added a new separate ball (not the same symbol) and I want to refer to the NEW ball's X and Y coordinates to see if I am running into the new ball. How do I refer to the other ball's (or any other object for that matter's) properties from within the ActionScript of the first object?

View 2 Replies

ActionScript 2.0 :: Referring To A Variable

Apr 17, 2003

say i have this code: blah = "123 + i" so blah is a variable right? so how would i refer to this variable? i want to be able to do: _root.blah.onPress = function () but this won't work beause you need an instance name instead, so how would you do this? thx, i hope you understood what i was saying

View 9 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 2.0 :: MC - Referring To Instance Name

Mar 31, 2006

im trying to, to make my MC have a rollover effect but my movie clip had been added by Action Script so this doesnt work

[Code]...

View 5 Replies

ActionScript 2.0 :: Referring To One Level Down?

Jan 29, 2008

How do you refer to the level one below the current level . I know _root refers to the bottom level, parent refers to one level above but I don't know what to use for one level below. Otherwise, is there a way to refer to a level by its name?

For my needs, I have a clip portfolio.swf that is loaded into a Base flash file. Within portfolio, is a loaded movie called Gallery.swf. Gallery contains a movieclip called Thumbnails which has buttons to load various image.swf files. Also within Gallery is an empty movieclip called "ContainerMC" which is where image.swf are loaded into when called upon by the thumbnail buttons. From within Thumbnails, I want to be able to refer to that movieclip "ContainerMC" which those selected image.swf files are loaded into. I can't use _root as that will refer to the base flash file. I can't use "this" as that refers to the Gallery file.

View 2 Replies

ActionScript 3.0 :: Referring To Clip By Name?

Mar 15, 2009

I have created a loop to add my clips by class and give them a name

tempClip = new clientsThumbs[i]();
tempClip.x = xPos;
tempClip.y = yPos;

[Code]....

How do I reference my instances by name

View 1 Replies

ActionScript 3.0 :: Add A Clip To The Stage As A Child And Remove The Parent And Set The Parent Equal To Null?

Sep 11, 2010

if I add a clip to the stage as a child and remove the parent and set the parent equal to null, does the child get collected and removed from memory? What if the child has an image loaded into it as its child? 

In my application I'm loading a series of png images as overlays that can be tinted for customizing in this app. When I trace my memory, the basic app idles at 64,000 k. The exact second I load those overlay images it goes up to 205,000k. If I remove those clips and "clear" the stage I should go back down to 64,000 k if everything is removed and collected correctly, right? It's not, it's hanging at 215,000 k. Are my images being cached and that is the reason for the memory staying up? If so, how do I prevent that. Or upon removing the parent of the image how can I un-cache the image.

If a user switches between models and loads several different items then the application actually crashes the Flash environment because of too much memory usage. It also does the same to browsers.

View 29 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

Flash :: Drag And Drop Application Where Mc Is Dragged Out Of One Parent Mc And Dropped Into Another Parent Mc?

Nov 13, 2010

Simple drag and drop application where mc is dragged out of one parent mc and dropped into another parent mc.All works OK until I added 2 text boxes to the mc's -- one is a non-selectable dynamic text box (a label) which is set by the code, the other is selectable input text that the user can amend.

Finger cursor disappears when user hovers over the section of the mc that contains the text fields (even non-selectable text??) When the user trys to drag the mc by inadvertantly click-dragging anywhere within both text areas it causes this error: TypeError: Error #1034: Type Coercion failed: cannot convert flash.text::TextField@2374a381 to flash.display. MovieClip (same error appears for both text boxes)

The input text box may confuse the user - how do they sometimes click to drag and sometimes click to amend? I need to create an overlay area within the mc that is click-detected for the drag? Here's the relevant bits of code:

var itemArray:Array = [
{iname:"police",ititle:"POLICE OFFICER"},
{iname:"insurance_assessor",ititle:"INSURANCE ASSESSOR"},[code].............

View 1 Replies

ActionScript 3.0 :: Tab Indexing Loop Through Parent, External Child Swf, Back To Parent?

Nov 11, 2009

I have a parent swf which loads many child swfs (though only one is displayed at a time). My intention was to use the loaded SWFs document class to retrieve an array of objects to be assigned a tab index, combine this with the parent's own array of objects and apply sequential tab indices to them all. But what happens is actually that the parent's objects are assigned an index, but the external swf is unaffected. In fact, the external swf retains its automatic tab indexing, when I would expect that having set a value for InteractiveObject.tabIndex, automatic tab indexing would be disabled.

I've seen similar tales elsewhere. Most posts I've read are wanting to load an external swf, give it focus and loop through those objects, then close the swf and return to looping through the parent. However I would like loop through all objects as one. including manipulating the focus manager(s), and basically fiddling with every tab-related property I know.

View 2 Replies

ActionScript 3.0 :: Referring To Instance With Variable?

Jul 23, 2009

I'm trying to access an instance by using a variable but when I try to manipulate a property to the instance (by referring to it with a variable) it only recognizes it as a string... for instance... (pun intended??)
public var prevbutton:String = "btn1";
trace(["page"+prevbutton]);
// which traces - pagebtn1
trace(pagebtn1);
// which traces the instance class - [object btn1pageclass]
I want to call the instance by using a variable... how do I do this?

View 11 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 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 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 A Child Instance Name?

Oct 6, 2009

still cant get my head around this..iv created balls inside a function is there a way to reference them out side of the function? with addChild() do they get instance names?

ActionScript Code:
makeBalls();
function makeBalls() {
for (var i:int=0; i<10; i++) {[code]...........

View 1 Replies

ActionScript 3.0 :: Referring To Stage Before Added To It

Jan 21, 2010

've been trying to figure out how to refer to the stage from a Sprite before it is added to the stage.

I'm working on a small program in which I plan to use external classes for each "window" that comes up. I've made the window classes extensions of Sprite. I'd like to make this window add itself to the stage when its constructor is called, and then just remove it from the window class when I'm finished with it. Is this a good idea? I'll post some of my code to show you what I mean.

This code doesn't work. I get the error "type was not found or was not a compile-time constant: Stage"

From my window class:

ActionScript Code:
public class PlayerSelectionWindow extends Sprite{
var stg:Stage;

[Code]....

View 2 Replies

ActionScript 3.0 :: Referring To An Instance That Does Not Yet Exist

Dec 6, 2010

The constructor class has the following code:

Code:
//Phase 2: Parse XML Data
internal var xmlParse:ParseXMLData;

[Code]....

View 7 Replies

ActionScript 2.0 :: GetURL Referring To An Anchor Name?

Jan 26, 2006

I'm using a little flashmovie as a button on a website, and I'm trying to link it to not only a certain page but also a specific place on that page. Right now I'm using the following code:

getURL("SS-nieuws-flash.htm#opendagen", "_self");

This only gets me to the right page, but not the right place on that page. Can this be done in Flash. I haven't been able to find any examples of it in the manual or on the web.

View 1 Replies

ActionScript 2.0 :: Referring To Movie Clips?

Oct 27, 2006

altering values of movie clips (couldnt think of another way to put it)say i need to change the _x of movie clip ##_mc

# being variables
i would normally use:
tellTarget ("_root."+A+B+"_mc")
{
_x++;
}

since the i cant just say _root.G5_mc._x++; cuz i dont know if its G5_mc or G4_mc (follow? im horrible at explaining things!)is there any other way of doing this? or do i have to use tellTarget?

i tried:

"_root."+A+B+"_mc._x" += 1;

but it didnt like that too much

View 5 Replies

ActionScript 3.0 :: Referring To A Variable Within A Class?

Feb 5, 2009

I have found a tutorial which shows me how to create a class. It also shows me how to construct an object in the main code. What I want to do is to access a variable from the object that I made. Heres the code...This is the link to the tutorial:http:[url]....

Code:
package
{
public class Car [code]....

Then I use this code to construct the object, which in this case is a car (the code is in my main flash file):

Code:
var mycar:Car = new Car("Porche", 3.2, 4, "Normal doors");

I understand all of the code, but how do I reference a variable like the engine? I have tried lots of things like "trace(this[mycar] .engine)", "trace(mycar.engine) but nothing seems so work. I just get error messages of property undefined.

View 4 Replies







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