IDE :: Add A Child Back To The Stage After A Brief Delay?
Feb 1, 2010I'm looking to add a child back to the stage after a brief delay, how might I do this in AS3?
View 1 RepliesI'm looking to add a child back to the stage after a brief delay, how might I do this in AS3?
View 1 RepliesI am attempting to add a movie clip to the stage when a button is triggered. When the user clicks the button the movie clip is added to the stage; it works fine, but the following problems occur:
1) The appearance of the movie clip is delayed.
2) The sound in the movie clip starts to play but the movie clip appears when the sound is finished.
Additional information: 1) The movie clip has the sound in the timeline.Here is the code:
Actionscript Code:
//Buttons: Adds movie clip to stage.readtomeShortA1.addEventListener(MouseEvent.CLICK, playShortAReadMe1);var playShortA1:ShortAReadMe1function..[code].....
2) However, I also want to know is keeping the sound in the timeline of the movieclip the most efficient way to use sound in the movieclip? Or is there better, more efficient way to do it?
I have a mainSwf in which I load an external swf, which loads an external swf.( a child of a child). I am trying to set the framerate via AS3 for the childs child by using stage.frameRate= 15;
It doesnt work when the children are loaded into the mainSwf. how to access the stage of a child's child? I have tried root, Movieclip, this but can not get it to work
I know how to get it to the top but I can't figure out how to get the child to the back
View 2 RepliesI would like to set the stage size to the size of a random jpeg after it successfully loaded. So I don't know the dimenstions beforehand. It there a way to do that without using javascript. I know there is a solution using javascript, but I don't want to use that. I know I can set the stage size by using [SWF(width = 800, height = 600)]. But that only works before you do anything else. Not after loading the jpeg.
View 1 Repliesi just started learning flash. Anyways, I have a movieclip that is removed when i quit the game from the menu e.g. removeChild(character). When i press "start" on the menu, i would like the character to re-appear. How can i add him again ONLY if he's been deleted?
View 6 RepliesI have a file in which I use this stage resize function. However if I resize really fast (like maximize button) it doesn't resize the Timeline.
Code:
stage.addEventListener(Event.RESIZE,resizeStage);
private function resizeStage(e:Event):void{
resetVideo();
_controlbar.resetControlBar(stage.stageWidth);
_barlength = _clickbar.width;
_levelstart = _level.x;
[Code] .....
If im usin function to add a mc to the stage like so:var myChild:MC= new MC();
function somefunc()
{
stage.addChild(myMC)
[code].....
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 RepliesI'm trying to build a class for objects in my prog that can by manipulated in various ways.. I want right clicking them to send them to back, and left clicking, bring them to the front.
ActionScript Code:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
[code]....
When I run it, however, I get ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.So something's not lining up, but I'm not sure how to write it so it'll work.
I'm having trouble with Matrix Transforms in Flex.
I have a Flex Canvas with nothing but an Image in it, like so.
<mx:Canvas>
<mx:Image id="img" source="/some/Url" />
</mx:Canvas>
[Code].....
The name of my DocumentClass is Main. So, what's the difference between :
var myClass:Main = new Main();
var mcInLibrary:MovieClip ;
/////////////////////////////////////////[code]............
I can't get the maxDisplayedLines to truncate the text at the end of my RichText object. It comes up with Error #2007 Paramater child must be non-null but I don't have a clue what would be null. The text I'm displaying is coming from textflow
textFlow="{TextConverter.importToFlow(rdesc, TextConverter.TEXT_FIELD_HTML_FORMAT)}"
and everything displays fine, even the thumbnails until I try to set the max lines. This is for mobile by the way.
the error is
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChild()
at flashx.textLayout.factory::TextFlowTextLineFactory/callbackWithTextLines()[C:Vellumranchesv22.0devoutputopenSource extLayoutsrcflashx extLayoutfactoryTextFlowTextLineFactory.as:267]
[code]....
I want to create a function based (not frame) delay of about 10 seconds to the function at the start of a flash movie, the code only needs to run once.I'm very new to actionscript and have been given links to SetInterval and SetTimer examples but they all seem to be very complex.The function is below. I believe it's possible to add the commandTimer(delay:Number, repeatCount:int = 0) how me to a simple example.
onClipEvent (enterFrame) {
framePos = int(_xmouse / 100 * _parent._totalframes);
if (framePos < 0) {
[code].......
I want the ability to go back to frame 1 when a user clicks anywhere on the stage that doesn't contain an object. Is this possible?
View 2 RepliesI 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.
I'm using Flash 8 and I'm having an issue getting back to the main stage once a movie clip has played. I have my file set up with three movie clips on the main stage. One just plays which is the banner, there are two rollover buttons on that mc for panel1_mc and panel2_mc. When you rollover to view panel1 it plays fine, but inside I have another button to take you to panel 2. That wont work...this is what I have for code for the button inside the clip:
[Code]....
I have created a set of MC's loaded from library via attachMovie in a for loop. Right now I have a set of MC's that are attached with the numbers 1-8. I would like to be able to select a MC and traces back its number. I know this can be achieved through an array. I know how to build arrays, but I do not know how to create an array what would trace back a number form a for loop.
Here is the code:
this.createEmptyMovieClip("navClip",this.getNextHighestDepth());
for (i=0; i<8; i++) {
currentThumb = navClip.attachMovie("numberBox", "clip"+i, i, {_x:(i*50)});
currentThumb.imageNum.text = i+1;
navClip._x = (Stage.width/2)-(navClip._width/2);
currentThumb.onRelease = function() {
trace(currentThumb);
};}
I need it to call back in the onRelease the number associated with that clip(array).
How do i make a movie clip go back to the main stage once it is clicked.. it has a roll in and out which is inside the movie clip.. i have a door and i want it so when you click the door it goes to another key frame on the main stage
View 1 RepliesI had attach a few movieclip in the main stage by using addChild() method. If I going to refer back to them inside other movieclip, How can i do so..
For example,
//attaching at the main stage
var earth1:MovieClip = new earth()
addChild(earth1);
[Code].....
How can I refer back this Movieclip from other movieclip's timeline?
I do a add child on my stage with this code:
var servicosMc:buscaServicos = new buscaServicos();
this.addChild(servicosMc);
servicosMc.name = "servicosMc1";[code]...........
Yeah this work but my application start with 24 mb of ram consumed. After I have clicked 3 times on this button and did this code above the application use 60 mb on the memory and the application do the same for the others button.
How to create realistic smoke coming out from the back of a missile flying on stage?
it's for a top-view arcade-type game, where the player shoots a missile from a plane...
I created movie clips that I want to add to the stage (from the library) by the use of buttons. I have a total of six buttons (and six moviclips) but I am trying to get the first two to work before I move on to the next buttons. The problem is I can't seem to remove the movie clip when another button is clicked, or the same button... Like I said I am new at this and I think a created a mess of things... I am getting error 2007 now
import flash.events.MouseEvent;
import flash.display.MovieClip;
mix_btn.addEventListener(MouseEvent.CLICK, addbear);
[Code]....
It may sound stupid, but how can I remove a definite child from the stage?[code]...
View 5 RepliesI am trying to replace a child on the stage. For this, I am checking if it exists first and then calling removeChild method, then adding the child to the stage.
flash code:
PHP Code:
btn.addEventListener(MouseEvent.CLICK,onClick);
function onClick(e:MouseEvent):void{
var lineShape:Shape = new Shape();
[code]....
The second time I press the button, I get this error:
PHP Code:
removed
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at Untitled_fla::MainTimeline/onClick()
I have a menu with three buttons and a head "scene" where i present my information. When I push a button in the menu three small pictures are shown on my "scene". Each picture should show a bigger version of the picture and here is the problem. The first picture is shown and it is possible to make it disappear with removeChild. But how do show the other two pictures?! I have tried to do the same as i have done with this picture but with no success.
function visaGolf(e:MouseEvent){
var headBtn:MovieClip = new btn();
headBtn.name = "headBtn";[code]....
I am trying to add a child to the stage through an array.
var one:First = new First();
var myArray:Array = new Array();
myArray[0] = "one";
[Code]....
I want to add a child by reffering the name in a array.
I am trying to remove a swf that I import to the stage, but it is not working.
Code:
function btn_cima_3call(clickEvent:MouseEvent):void{
page = 5;
esconder();
content.gotoAndStop(page);
ld.load(new URLRequest("trabalhosV0.swf"));
ld.x = 0;
ld.y = 100;
addChild(ld);
}
So when 1 button is pressed this swf is imported to the stage. but im now trying to remove this when another button is pressed and it isnt working?
Code:
function btn1call(clickEvent:MouseEvent):void{
removeChild(ld);
page = 1;
content.gotoAndStop(page);}
I am writing a program where the user can, in the simplest terms, drag and drop things on to the stage. I need the user to be able to save what they have done and when they come back choose to reload their previous project. My plan was to write all the information(object class, x and y values etc) to an xml file and when the user chooses to load a particular project, rebuild the stage with all objects in their correct locations. My problem is, how do you add an xml element with all of its attributes and child elements dynamically for each object added to the stage?I'm relatively new to XML, but I figured this would work:
ActionScript Code:
var test:XML = <test/>;
test.title = "Test XML";
for (var i=0; i<platform.numChildren; i++) {
[code]....
in a for loop as well. But, these give me a warning that says "adding an element with more than one item is not supported" or something like that.
I am adding a child to the stage in my first swf
Code:
addChild(new donkey());
var l:Loader = new Loader();
l.load(new URLRequest("next.swf"));
addChild(l);
in my next.swf, I have a button which I want to remove the donkey with::
Code:
removeChild(donkey);
OK - doesnt work - it doesnt let me export the swf anyhow because the next.swf has no 'reference' to donkey existing at all. What's going on?