Parent/root Functions, Importing The "children"?
Nov 11, 2009
I have an swf file, MyRoundButtons, which is a set of radio buttons I built (not components). It works fine, but if I import it into a parent it won't work anymore. I have to write a script to load it into a movieclip, (which I hate, because I'll have a several different swfs to assemble on my final stage. I really want to see them all on the stage together, not just at runtime.)Even when I load it into a clip and the buttons work, however, it doesn't seem to have a separate timeline when double-clicked ,and: I can't make the imported buttons control the timeline of the parent. I defined a test function:
Code: Select allfunction goToNirvana() {gotoAndPlay("nirvana")};
Frame "nirvana," in th parent, has a Trace instruction in it.goToNirvana works on its own in the parent. Now to call the function from within the child:
Code: Select alltv_btn.onPress = function(){
gotoAndPlay("TV");
// That last part triggers the button's down state and sound in the child timeline, in frame "TV."
[code]....
Whether I define that function in the child, the parent, or both, the instruction won't work. Now, I'd prefer not to do the loadMovie thing at all if I can avoid it, I'd rather have fully rendered button clips onstage at authoring for me to arrange and move about, with fully independent timelines right there. But you see what I'm trying to do. I just can't get it done.
View 2 Replies
Similar Posts:
Mar 16, 2010
I cannot use the following in my ActionScript due to conflicts with the host application:
_level0
_root
_parent references
On a pop-up box I have a close button with an absolute reference: closeBtn.onRelease = function{ unloadMovie("_level0.Page_1.holderBox");} Is there another way to make this work without using _level0 or _parent? I've read that it is possible to use a global variable on the main timeline and ref that, but cannot get that to work.
View 7 Replies
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
Sep 28, 2009
I'm importing one swf into another and then scanning the children types in the imported SWF. When I do the following, the bitmaps return as Shapes.
Code:
for(var i:Number = 0; i<importedSwf.numChildren; i++) {
trace(importedSwf.getChildAt(i));
}
What I need to do is evaluate the bitmaps in the imported SWF file and see if they have their smoothing property on or not.
View 3 Replies
Sep 22, 2009
How can i access a function that is in a movieclip from the root?
i've tried these :
mcName.functionName();
MoviClip(mcName).functionName();
but all of them didn't work at all.
View 1 Replies
Dec 19, 2010
Is there a way to tell flash to instantiate a Stage subclass called "TheStage" instead of the default Stage class as root/parent of my document class?
public class TheStage extends Stage{
//code
}
Then when I do "DisplayObject.stage" I want it to return the instance of TheStage instead of the default Stage insteance. I want to do this so that I can override the addEventListener method of the Stage class. So if I call DisplayObject.stage.addEventListener I can execute my own code routine. Is that possible and how?
View 8 Replies
Jul 23, 2009
I am able to access main root from an external swf by doing this:
MovieClip(root.parent.root)
but how to avoid getting an error when testing external swf alone? Is there any try catch system I can do to avoid thoses errors?
View 1 Replies
Feb 14, 2005
So What is the Real difference between .root and . parent??? I need to know the difference between the two are.
View 1 Replies
Sep 10, 2008
Even though i know not much of actionscripting, i like to make sites that are flash-based, so i keep on challanging myself with that. But now i stumbled into something, and i just cant find a solition! here is my problem: I have made dropdownmenu's in a movieclip and the mc works with hittest like this:
[Code]...
View 1 Replies
Jun 30, 2009
I have a 13 movieclips within another movieclip which in turn is placed on the root timeline. I have written a function in the actions layer of the main timeline:
function illboxClear(){
_root.illpre.ill1.gotoAndStop(1);
_root.illpre.ill2.gotoAndStop(1);
_root.illpre.ill3.gotoAndStop(1);
_root.illpre.ill4.gotoAndStop(1);
[Code] .....
It sends the animation in each of those described movieclips back to frame one as you can see. When I try to call the function from actions on a button which itself within a separate movieclip placed on the stage:
on (rollOver) {
illboxClear();
_root.illpre.ill2.play()
} on (rollOut) {
_root.illpre.ill2.play()
} on (release) {getURL("boxer.html","_blank");
}
It doesn't work! Can I not call functions from button objects or have I made some other elementary error?
View 7 Replies
Oct 20, 2009
Having some strange problem getting a width from objects placed on stage using addChild. I am under the assumption that when I add some children to a specific parent, the parents width will increase and I can use that number to immediately act on the parent. The width is 100 when traced no matter when or where I add the children. I can change it statically but the is a desktop app which depends on screen size.[code]
View 1 Replies
Jul 27, 2010
I have multiple children movieclips containing png images inside of a parent movieclip. The parent movieclip has a slow looping animation. The children don't stay in sync with one another during the animation. It becomes obvious to see because there is a background child clip with other child clips on top of it. It appears to only happen with movieclips containing a bitmap image. Does anyone have an easy fix or work around for this?
View 5 Replies
Mar 2, 2009
I have 2 movieClips loading images using XML files.
I need to set the position on this movieclips from the parent depending on their width.
The problem is that the parent have to wait that both children have loaded the images before to proceed.
View 2 Replies
Jan 3, 2012
how do i retrieve the top level parent of an xml node in actionscript please?
<companies>
<company id="1" name="boo" level="1">
<company id="2" name="hoo" level="2">[code]......
View 1 Replies
Feb 19, 2010
I have a main flash movie that loads three external movies, the external movie buttons don't work when loaded onto the stage.
In each external swf thats loaded, the button actionscript is in this form:
HTML Code:
on(release) {
_root.gotoPage(2);
}
And this works when each swf is loaded stand-alone. But not when loaded as an external swf.With the numbers ranging from 1-19 as far as pages. How should I edit the code so that these buttons work when loaded externally?
Code:
on(release) {
_parent.gotoPage(2);
}
[code]...
View 0 Replies
Dec 4, 2010
I am trying to create a global function to reuse repetitively. It worked until I moved the function to the external .as file. The problem is with MovieClip(root) and MovieClip(parent). They do not work and cause errors.
[Code]...
View 0 Replies
Jul 12, 2009
am new to flash and am trying to create simple program, I kinda know how to code the program but its really difficult to interpret everything into action script. For example I created class file in file node.as
[Code]...
View 2 Replies
Apr 29, 2010
I have a set of movieclips that are added as children to a parent mc. I want to scale the parent mc up but keep one of the mc's in the same place on the stage. I think the easiest way to do that is to scale the mc up, calculate how far the child mc moves and move the parent an equal amount in th opposite direction. Everything works but I can't for the life of me wrap my head around the math required to calculate the distance to move the parent mc. Has anyone else tried this? Is there an easier way that I don't know about?
View 2 Replies
Sep 17, 2010
I'm making a rather large flash project and so I'm concerned about memory usage. At the end of each section of the application I remove the overarching parent element that holds the content. Although this remove the parent, does this also free up the memory for each of the children contained within this, or should I run an iteration to remove those prior to removing the parent?
I'll give a little more explanation in-case I'm not expressing what I want:
addChild(movie1);
movie1.addChild(movie2);
movie1.addChild(movie3);
By using this code:
removeChild(movie1);
Does it remove movie2 and movie3 from memory or are they still stored, just unlinked?
View 3 Replies
Oct 26, 2010
I have setup a "LayoutPage" custom class (based on MovieClip) and I am attemptimg to create a "selected" behaviour.When I assign my "addEventListener(MouseEvent.CLICK,toggleSelection)" from within my custom class, everything works as expected, clicking any object of that class does display the correct behaviour.
Now, I would like to extend the functionality by adding keyboard modifyer to either extend the selection or replace it.For this, I thought of moving the "addEventListener" out of the class and put it inside the parent instead (my "PageLayout" class where all the "LayoutPage" live). But by doing so, the click event no longer register on the "LayoutPage" class but rather on its individual children (Page icon, Page number text field, Page Highlight shape, etc.)
View 1 Replies
Feb 1, 2011
How do I get a list of all the children (Sprites) on the stage of my Document Class OR how can I get a list (length) of all the children (Sprites) of a parent (Sprite)?
View 1 Replies
May 17, 2011
How to avoid children inheriting parent's colortransform in flash?
View 2 Replies
Jun 15, 2007
is it possible to retrieve all children of a certain type from a parent in actionscript 3?i only see getChildAt,getChildByName, is there a getchild of a certain type like get all childs of object type:Food?!!!
View 3 Replies
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
Feb 12, 2011
I'm using a PreLoader as a parent SWF that loads the actual website as a child SWF. In the website SWF, the child SWF, will MovieClip(root) still work and refer to it's own root, or the PreLoader's root? And would I still access the websitite's document class (the child's document class), through MovieClip(root)? What if both files have a document class?So my main question is how do document classes and MovieClip(root) behave in the scenario when you have:
Parent SWF - document class, MovieClip(root)
|
Child SWF (loaded by parent) - document class, MovieClip(root)
View 2 Replies
Nov 14, 2010
What's the best way of resizing parent movieclip without affecting the children? I have a container movieclip that resizes depending on the stage, and when I add another movieclips to it they also resize, but I want them to keep the original size,
View 3 Replies
Apr 16, 2011
I'm doing an AS2 project with a parent.swf that loads many child_##.swf's. they each use identical buttons and other library assets.tried using Shared Library concept two different ways:
1 - created library.swf and used assets from it for child swf's ... no problem when child is played by itself, but when parent loads the child's, shared assets do not work,
2- established parent.swf as the 'library', and followed the common steps of Shared Library setup, but shared assets did not work. of course, using class files works, but still I need a central place for the graphics ( I'm avoiding having my classes create graphics via draw methods ).
View 1 Replies
Jan 27, 2011
I have a parent node and I'm trying to get each child node under that parent and store it into an arraycollection? How could I go by doing this?
View 1 Replies
Jul 5, 2011
is it possible to retrieve all children of a certain type from a parent in actionscript 3? i only see getChildAt,getChildByName, is there a getchild of a certain type like get all childs of object type:Food?
View 2 Replies
Dec 23, 2009
I have a rectangular movieClip named 'container'. In this movieclip, a function generates some number of squares.My problem is that; for example, if I generate 12x12 squares with each width/height of 40; it resizes the container to width/height of 480. If I set the width and the height of the container movieClip to a lower value; then the squares become smaller.I have been struggling for some time on this problem. I tried setting the ScaleMode of container and squares to various values but it did not work.How can I overcome this illogical (for me at least) problem? How can I prevent children from resizing their parent OR how can i prevent parent downsizing the children?
View 2 Replies