Actionscript 3 :: Flash - Child Within Parent Within Parent?

Aug 24, 2010

I am trying to make a calculator where a user can select from a list of items. If a user clicks say "ITEM1", it should add the item to a "CONTAINER_MC". The problem i have is all my data is set inside an array containing names and prices like the code below.

[Code]...

View 1 Replies


Similar Posts:


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 :: Parent.removeChild(child) Doesn't Update Parent Width / Height When Child Was Rotated

Jul 29, 2011

I got a Parent Sprite, let's name it SpriteP, which holds inside it two other Sprites. Sprite1 and Sprite2.[code]Sprite2 is a rectangle. When I rotate it, of course, the height of its parent, SpriteP, GROWS. But I would expect that height to go back to what it should be when I'm removing Sprite2!And it does! If I remove Sprite2 while NOT being rotated, the height of the parent drops back to normal, 200.

View 10 Replies

ActionScript 3.0 :: Child-parent Relationship \ Adding Them All As Children Of The Stage And Creating A Parent-child Hierarchy Between Them?

Jun 6, 2011

i am slightly confused about the parent and child relationship. lets assume we have several different instances, what would be difference of adding them all as children of the stage and creating a parent-child hierarchy between them(other than the access path).

View 5 Replies

ActionScript 3.0 :: Parent.removeChild(child) Doesn't Update Parent Width/height When Child Was Rotated

Jul 29, 2011

I got a Parent Sprite, let's name it SpriteP, which holds inside it two other Sprites. Sprite1 and Sprite2.

When Sprite2 is NOT rotated:

Code:
trace(SpriteP.width + ' ' + SpriteP.height); //100 250.
SpriteP.removeChild(Sprite2)
trace(SpriteP.width + ' ' + SpriteP.height); //100 200. -> works, 200 is good.
When Sprite2 is rotated at 90:

[Code].....

And it does! If I remove Sprite2 while NOT being rotated, the height of the parent drops back to normal, 200. But if I rotate Sprite2, the Parent won't update its bounds.

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

Flash - Drag Child Mc Out Of Parent Mc And Add To New Parent Mc?

Oct 6, 2010

Here is a working script to drag drop a ball from the stage into another target mc:

ball.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
stage.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void{ [code]...

It works well but I'm new to AS3 and I am having difficulty amending this script to drag the ball out of a parent mc (instead of the stage) and onto another mc (the target mc). To explain: imagine a ball, a box, a tri, + more shapes all within a scrolling mc (initial parent), the user scrolls to select a shape, then drag-drops onto a target mc on the stage.The scrolling is no problem, but how would you amend the script above so that the ball can start inside a parent mc rather than on the stage itself?

View 2 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 :: 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 :: SetChildIndex And SwapChildren - On Mouse Over Set The Parent Of The Moused Over Text Field To The Highest Depth Child Of Its Parent

Sep 29, 2011

trying to on mouse over set the parent of the moused over text field to the highest depth child of its parent i tried both of these: [code] private function

[Code]...

View 3 Replies

Actionscript 3 :: Assign A Parent's Variable From The Parent's Child?

Nov 7, 2011

i want to pass the variable from parent to child .How Can i pass the Variable.Here i paste my code.

My Parent Class

public class PlayerStrobe_domaincheck extends Sprite
{
private var myService:NetConnection = new NetConnection();
private var _loader:Loader;

[Code]....

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

Flash :: AS2 Parent - Child Swf Communication

Feb 29, 2012

How do I do this? Inside the parent swf myVar value is set by query string value loaded in by swfobject var myVar = _level0.part; // i have the value 123 here ..all good so far

[Code]...

Always childLog.text is undefined :( - so how to access the value of myvar from the child?

View 1 Replies

ActionScript 3.0 :: Flash - Should A Child Know Its Parent

Oct 30, 2010

I am working on a component framework for myself right now, and was wondering if a child component should contain a reference to its parent. Obviously flash itself does this as part of the movieclip parent/child structure, so I figure it's okay to do this, but does this present any memory problems or anything, having references to the parent in the child? Would it be better to do some sort of lookup tree, just passing each child an array of GUIDs or similar which I could use to trace a component back to all its parents?

View 14 Replies

Flash :: Share Classes Between Parent And Child SWF?

Aug 13, 2011

So i have a situation where i want to pass a object of a class say 'MyBigAwesomeClass' from a child to a parent. I import the class definition into both the parent and child. Now, if i load the child swf from a location that is relative to the location of the parent , all is fine, however the moment i load it using a full absolute path, it treats the definitions for 'BigAwesomeClass' in parent and in child as different and does not allow an object of the type 'BigAwesomeClass' to be assigned to an object of the same in the parent class.I am totally stumped, and have banged my head over ApplicationDomains, including using this code

loader.contentLoaderInfo.addEventListener(Event.COMPLETE,swfLoaded);
var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
loader.load(new URLRequest(_file.url),context);

[code].....

View 4 Replies

AS3 :: Flash - Passing Variables From Parent To Child?

Oct 14, 2011

I'm trying to access some variables from my parent in my child MC.

Parent code:

var data_history:String;
function finish_checkUp(event:Event):void{
var checkUp_stat:String;

[Code]....

Now as you can see, i have tried the trace method, but with no luck. Flash doesn't report any errors regarding the trace method, but does report the two undefined vars (data_history). Ive tried to use the trace method above all the functions, at the top of the script, still the same errors though.

View 2 Replies

Flash - AS3 Font Embedding From Parent To Child SWF

Jan 10, 2012

I have a parent swf with fonts embedded in the library, which have export for actionscript set and a class name assigned. The patent swf loads a number of child swfs to which I'm trying to pass a textformat object using a desired font from the parents library. How can this be achieved. I have tried Font.registerFont(font class) and created a new instance of the font before setting the textformat, but this only works on machines with the font installed. In the child swf, the textfield text is set, then the textfomat applied with setTextFormat();

View 2 Replies

Flash :: Animate A Child Independent Of Parent?

Feb 9, 2012

We are creating a system where elements in a display unit are defined through xml. This also means that the whole system is dynamic in nature. [code]...

View 2 Replies

ActionScript 3.0 :: Flash Calling Parent From Child

Jul 21, 2011

In my child constructor I use MovieClip(this.parent).blablabla() to retrieve info, yea I know I can pass it through the constructor, anyways I keep getting errors anytime I try to use MovieClip(this.parent) in the constructor, it gives a refrence error saying it's null.

Why doesn't that command work, is there a way around it (other than the constructor)? Is it because it's bad design? I'm calling a function that has alot of data, so I'm just passing this to the child and using the passed this data to call the parent atm, looking for a better MovieClip(this.parent) solution.

View 2 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 3 :: Flash - Change A Variable In The Parent From The Child?

Mar 6, 2010

I want to change a variable set to 0 in the parent to 1 when a button in the child is clicked.

This is the parent zero.swf:

var noPass:Number=0;
function getPass(event:onLoad, noPass):void {
if(noPass==0) {

[Code]....

View 1 Replies

Flash - How Parent Pass Text String To Child SWF

Apr 29, 2010

Parent loads Child, and wants to pass text string to Child. How can Parent pass a string
to Child swf?

PARENT.SWF
//LOAD CHILD 'has a symbol on stage called LDR that CHILD loads into'
var loadCHILD:Loader = new Loader();
LDR.addChild(loadCHILD);
var bgURLTxt:URLRequest = new URLRequest("CHILD.swf");
[Code] .....
CHILD.SWF
'has DynamicTextfield called txtBuddy'

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

Flash :: Passing Data From Parent To Child In ActionScript3?

Nov 10, 2011

I have two swf, A.swf and B.swf: B.swf is a child of A.swf.i want to access the variable of a.swf in b.swf.Is it Possible?How Can i do this?

[Code]....

View 3 Replies

ActionScript 2.0 :: Passing Variables From Parent Flash Into Child?

Jul 26, 2010

how can I pass a variable from a parent flash file to a child flash file which it calls?We have a parent flash file which imports various child flash files based on instructions in an XML file. It's probably easier to see an example - opg2DOTcoDOTuk/flash/yay.html (replace the DOTs, couldn't post an url due to restrictions) - the text above each page, and the 'enlarge page' lightbox links are all in seperate flash files (one per double page) which are brought in, depending on the pages you are looking at, based on the instructions in an XML file which looks like this...

<page ani_swf="pages/text1.swf">pages/white.jpg</page>
<page ani_swf="pages/text1.swf">pages/0001.jpg</page>
<page ani_swf="pages/text2.swf">pages/0002.jpg</page>
<page ani_swf="pages/text2.swf">pages/0003.jpg</page>

etc, where the swf is the header flash file containing the text and one or two lightbox links, and the jpg files are the page images that appear.We had to repeat the imported child flash file because of a glitch when you go backwards through the book otherwise.

This system has been fine for us up until now but recently we've had to look at making it a dynamic system, so the content of the book can be varied depending on a variable being passed into the parent file via FlashVars...

<param name="FlashVars" value="zone=1" />
<embed src="newbook3.swf" FlashVars="zone=1" ....etc

This makes the book load an xml file called "1"). This is fine, except we also need to vary the 'enlarge page' target images to match.The 'enlarge page' links are currently hard coded into each child flash file, like this...

on (release){
getURL("javascript:SWFDelegate('imagename.jpg','Ex ample');");
}

- What we've tried so far:

1. Trying to pass the variables in querystrings from the XML
eg.

<page ani_swf="pages/text2.swf?var1=image1&var2=image2">pages/0002.jpg</page>
<page ani_swf="pages/text2.swf?var1=image1&var2=image2">pages/0003.jpg</page>

with the child flash setting it's action like this...

on (release){
var image1 = var1 + ".jpg"
getURL("javascript:SWFDelegate(image1,'Example');" );
}

I'm not sure if the syntax here is correct. We have to add the ".jpg" in here because, as far as I understand it, you can't pass "." in a querystring.

2. Passing the variables for the child into the parent

I read somewhere that variables passed to a parent are automatically available to a child. Not sure if this is true, but it didn't work for me when I tried it like...

<param name="FlashVars" value="zone=1?var1=image1&var2=image2" />
<embed src="newbook3.swf" FlashVars="zone=1?var1=image1&var2=image2" ....etc

Combined with...

on (release){
var image1 = var1 + ".jpg"
getURL("javascript:SWFDelegate(image1,'Example');" );
}

...in the child button action.

View 2 Replies

ActionScript 3.0 :: Make Flash Child & Parent Linking?

May 29, 2010

Im working on a small project & Im not good in AS3. So please bear with me, I tried searching but cudnt find the keywords for this function.I have a Parent.swf that loads a Child.swf on the main stage of the Parent.swf that works perfectly with this as3.0.

PHP Code:
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("external/child.swf");

[code].....

View 1 Replies

ActionScript 3.0 :: Flash Executing Parent Function From Within Child

Jun 11, 2010

I have this movieClip "Container" and within it on two different frames I have two movieClip/buttons, "pause_btn" and "play_btn", respectively. I would like to call a function on the main timeline on frame two of "Container" where "play_btn" is located.
I think I'm getting close but really have no idea. I know about the visible property and have been considering that, but isn't there a way to call a parent function from within a child movie clip? The code looks like this.

[Code]...

View 3 Replies

ActionScript 3.0 :: Flash DispatchEvent - Send From The Child To The Parent

Jun 16, 2011

iam trying to move forward and learn as3 i am converting complex project i worked on last year using AS2 , now i have problem in dispatchEvent command i have class extends MovieClip that need to fire Event to sub sub childs i can send from the child to the parent using

[Code]

View 12 Replies

ActionScript 3.0 :: Flash Parent Invisible And Child Visible?

Jan 3, 2012

Is there anyway a Dispaly Object can make its parent invisble = visible=false,
But the child remains visible?

Just trying to save on re-writing a batch of code so its the normal parent child relationship.

View 3 Replies

ActionScript 3.0 :: DropTarget Parent Child - Removechild Won't Remove A Child

Aug 21, 2010

I have an issue where removechild won't infact remove a child. I think its something to do with my dropTarget.parent issues. The concept of the code is that you drag a source onto a destination. When you drop the source onto the destination you will get a text field that says "Hello" or "Goodbye". The objective i want to achive is that once i drop a source onto the destination, removechild will remove any previouse textfields added. This is proving difficult.

[Code].....

View 3 Replies







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