ActionScript 3.0 :: Stage Resize Actions Inside A Child SWF?
Sep 24, 2010
I've ran into a very nasty little problem that has been buggin me for few days.
Basically I have a main (parent) swf which loads the content of the sub pages into a MovieClip called mc_container.
Inside every child SWF I have a code to repostion and resize its contents as I need with stage.addEventListener (Event.RESIZE, relocateandresize);
But the problem is, once this SWF is embedded into the main (parent) swf, this code stops working.
View 1 Replies
Similar Posts:
Mar 24, 2011
I've done a website with different pages using the Loader component. On one page I have a movieclip that has different images (like a slideshow) that fade between each other. I'm trying to add an action to make the movieclip pause for a few seconds between each fade. So I've added this action between each fade (in a layer, above the graphics layers, that only holds actionscript):
Code:
stop();
function restart(){
[code]....
View 3 Replies
Mar 8, 2007
I have got a heirarchy of objects which goes like this -> stage.control_mc.gaincontrol_mc.knob_mc
i am trying to register an event listener for stage from within knob_mc using stage.addEventListener("mouseUp",this.mup2); and i have defined the function mup2 within the knob_mc class - but when i run the movie and dynamically add the knob_mc to the stage i get this error
TypeError: Error #1009: Cannot access a property or method of a null object reference.
i dont know why stage is a null object. when i trace stage from within knob_mc i get null....
View 1 Replies
Apr 26, 2008
I have 9 movie clips which are all of the same object, they get larger or smaller as the mouse gets closer to their respective centers. The functionalilty for this is in an AS3 class file that extends flash.display.MovieClip.How do I go about swapping depths so that the largest one is in the foreground, I am new to AS3 and dont seem to be able to find a way of getting the depth of the movieclip I am currently inside (this) and if I try to access the stage to call swapChildren I get the following runtime error:
View 6 Replies
Nov 23, 2011
mHook -> mBottom -> hItemButton -> itemButton[a] -> itemButtonExp[a]
so i press another butoon, and retrieve a number 2, how do i access itemButton[2].itemButtonExp[2]? Coz i need to change the text field in there?
in AS2 i can access it directly by changing itemButtonExp[a].text, but how do i do it in AS3?
View 3 Replies
Jul 13, 2009
This is just a stripped down version of my problem that im using for troubleshooting purposes. I thought id try and make up a basic script to get the core of it working and then apply it to the file that im having this problem with later just to simplify things.So what im trying to do here is that ive got a MovieClip in my library called mc_brian that ive exported for action script with the class of Brian. The mc_brian movie clip has 2 frames, both with stop actions on them.So ive created my variable newBrian and loaded the Brian class into it, positioned it and added it to the stage via the addChild display object.Then im assigning newBrian an instance name and tracing the instance name, which of course returns "brian1":
Code:
var newBrian:Brian = new Brian();
newBrian.y = newBrian.x = 100;
[code]......
View 1 Replies
Feb 25, 2010
I'm an animator trying to use actionscript along with timeline animation.The setup is flock>fly>wings flock movieclip 30f long, the script looping, starting multiple fly movieclips at different points.
fly movieclip 30f long, controls wings0 movieclip timeline (3 frames, each with a movieclip). Frame1: wings0.gotoAndStop(2) Frame24: wings0.gotoAndStop(1) Frame48: wings0.gotoAndStop(3)
From flock timeline I'm trying to override actions in fly3. to call a different wings0 animation.
flock Frame1: var loop:Number = 0; fly1.gotoAndPlay(15); fly2.gotoAndPlay(8); fly3.gotoAndPlay(20); if(fly3.currentFrame==24){ fly3.wings0.gotoAndStop(3); }
flock Frame 30:
loop = loop + 1;if (loop > 0) {this.gotoAndPlay(2);} else {this.stop();}
But the animation of fly3 doesn't change.
View 7 Replies
Apr 29, 2011
I am having issues trying to get a simple button to make the playhead jump to a certain frame when pressed. I have the main timeline and then have a movieclip which has buttons inside of it and actionscript applied in the movieclips timeline. Is this a no? That is should all actions go on the main timeline? If this is so then does anyone know why I keep getting an error that it can't find the instance named button inside the movieclip?
portfolioButton.addEventListener(MouseEvent.MOUSE_ DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
gotoAndPlay(100);
}
View 7 Replies
Mar 13, 2009
I've found the solutions for most of my many problems with as 3 but this one is really baffling The frame actions of child-movieclips of dynamically added movieclips are not firing! If I have movieclip, say "mc", which contains a child-movieclip "submc" which has a timeline animation in it with "stop();" on the last frame and I add "mc" on the stage via addChild() the stop action inside the sub movieclip will not work.
All the frame actions inside "mc" itself work. Everything works if I drag the movieclip onto the stage manually. Right now the only way I can see to stop a movieclip on its last frame is by using the ENTER_FRAME event, but that's awfully cumbersome.
View 9 Replies
Mar 24, 2009
How can I filter a loaded xml to only do my actions depending on if a xml child matches my request?
View 5 Replies
Feb 2, 2005
I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.
var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();
[code]....
View 2 Replies
Jun 6, 2010
I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.
var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();
[Code]....
It dies every time on that last line. How do I refer to that vidThumbn instance so I can add the imageLoader? I don't know what I'm missing. It feels like it should work.
View 2 Replies
Oct 19, 2011
I'm writing a web based flash app that's written entirely in AS3. I have objects on the screen as part of a GUI. I would like the user to be able to resize the window, or make it full screen. I would like everything to auto-scale with the resize, but also remain in the same relative position on the stage.
View 1 Replies
Feb 27, 2006
i saw a thread while ago .. that always position a movieclip in the middle of the stage even if the stage or window resize any1 can point me to it
View 3 Replies
May 10, 2008
When you resize the browser window the thumbnails rows and columns adjust accordingly to fit.I've managed to attach the thumbnails correct when my enableButtons() function is called but i'm unsure how to approach resizing.
Stage.align = "TL";
var numberOfGalleries:Number = 20;
var thumbMarginX:Number = 163;
var thumbMarginY:Number = 109;
[Code].....
View 1 Replies
Sep 9, 2009
I've got a large bitmap (1920 x1306) that my client wants as a bg image, scaled to the swf size on load (930 x 575); but that can "grow" up to its original size if/when a user expands the browser window. All the rest of clips in the display list are to remain in place (except for a copyright clip, which they want to always be 14 pix above the bottom of the browser frame. I've tried loading the bitmap dynamically at full size and then using scaleX,scaleY to set it's initial smaller (930x575) size, and I've tried just setting the height/width of the dynamically loaded image using the math of scaleX,ScaleY just in case the scaleX "transformed" the bitmap so that it couldn't return to its original size. Both make the bitmap the right size. But the resize function below did nothing to it, (or the copyright.y.) THEN I tried just putting the bitmap into the display list (both sizing methods work here, too). But even as an original member of the compiled display list, the resize event is still not reaching the target. Everything I've seen on the web says this should work - but...no luck.
Here's the AS3 code in the 1st frame of my swf:
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
[Code]......
View 1 Replies
Mar 24, 2009
how I can make a certain code that works on the time line, work when placed inside of a MC? I know my question is too vague but my code is huge and if I post it it's going to be more difficult than if I can just get the logic and change the code my self.
View 12 Replies
May 1, 2007
I have a movie clip that has a few layers and a button on one of the layers. on the button I have this code:
on(rollOver){
gotoAndPlay("over");
}
on(rollOut){
gotoAndPlay("out");
}
Now, this mc is on the Main timeline and has an istance name "home_btn". I have a sliding menu type navagation going on and have some code for the "home_btn" on the main timeline:
home_btn.onRelease = function(){
menuSlide(contentHold.content1);
}
WHen I try to use the code on the maintime line and the code on the button inside the mc--it ofcourse doesn't work. How can I reference the rollover/out actions on the inside of the mc from the main timeline?
View 1 Replies
Jan 8, 2011
I got a set of buttons and a text field where they load the content.I'm trying to not make one zillion functions and keep the code neat so i guessed i would try set the buttons' actions within the loop too. I firstly had some problems getting the i counter inside the onRelease function (actually I don't think i ever got how to do it). But I tried this and worked:
stop();var comprarXML = new XML();comprarXML.ignoreWhite = true;comprarXML.load('flash/comprar.xml');comprarXML.onLoad = checkLoading; function checkLoading(success) { rootNode = comprarXML.firstChild; ButtonReleaseAndContent ();} function ButtonReleaseAndContent (){ for (i=0;i<12;i++){ // my buttons are not generated dynamicly, that why the count. btTemp =
[code]....
At the line where I set the text, I had a though " I may have to refer from within the button mc, since the generated code goes inside it!". So i tried the this.temp , guessing that this would be equal to the button level. A few seconds later i noticed my referencing for the text field wasn't coming from within the button, but from the root.
View 3 Replies
May 25, 2010
How do I make the actions contained in a movieclip work on the main timeline? For example. In the movieclip, I have some buttons and I have an "Actions" layer there which contains all the functions of the buttons, listeners and such.
I placed this movieclip on Frame 1 of the main timeline.
When I run the program, I'm able to hover my mouse over the buttons and it changes to a "finger" cursor as if they can be clicked on, however, when I click the buttons, nothing happens. It's as if it's not recognizing the Mouse Click event listeners I put on the buttons in the "Actions" layer of the movieclip.
View 1 Replies
Jun 10, 2010
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
View 9 Replies
Jul 22, 2009
I have a page-like flex application. In my main application is a holder (a canvas) that displays all the pages. The problem is that the components that are loaded inside the holder are bigger than the holder is when the main application starts. The holder height is set to 100% but still he gets scrollbars when I load a bigger component inside of him then himselHow can I solve this problem? And if it isn't solvable would it work correct if I use a viewstack?the holder looks like this:
<mx:canvas height="100%">
</canvas>
But the end of the application is 500 pixels lower so canvas height is 500 pixels high. Now I put a new child inside the holder that is 1000 pixels high.
View 2 Replies
Aug 12, 2010
I'm working on a project for my elementary school students using a book, some mp3s, and some images of text. The main movie clip is called "halloweenWitch" and it's about 10,000 frames long. Every 500 frames or so there's a keyframe for new images of the text. I'm trying to access child movie clips (mc0-mc18) to tween (resize) using code that I found here. [URL] However when I try to access the children with:
Code:
Effects.resizeIt(halloweenWitch.mc0,1,2,2);
From the main timeline I get an error.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
When I debugged the program it said that the problem was this line in my Effects.as file.
Code:
targetMC.addEventListener(MouseEvent.ROLL_OVER, resizing,false,0,true);
targetMC.addEventListener(MouseEvent.ROLL_OUT, resizing2,false,0,true);
I think it has something to do with initialization but I'm not sure how to write a function that would tell the stage to wait until all objects inside halloweenWitch are present, nor even if that's what I'm supposed to do.
Code:
targetMC.addEventListener(Event.ADDED_TO_STAGE, init);
??
View 5 Replies
Feb 23, 2011
i have a button (name: closeinfo) inside a moviclip (name: infopanel), im using this code to put actions to that button:
[Code]....
View 1 Replies
Jul 25, 2007
How I can restrict actions to the stage? I have objects that float dynamically when I move the mouse over the stage. If I publish my file as html and click on the area surrounding the stage the objects move...
View 2 Replies
Nov 23, 2011
i have the following code to play a video stored in the media server:
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[code]......
View 1 Replies
Oct 19, 2011
I'm making a map editor in flash. For the map area, a dynamic Movieclip will this and that in it will be loaded into a movieclip area, but I realised the problem of how a symbol resizes when a child is too big in the symbol.
Is there ANYWAY to stop it from it from doing this, as I want a specific window for this where you can drag the map around to see the other areas.
View 1 Replies
Aug 11, 2011
If im usin function to add a mc to the stage like so:var myChild:MC= new MC();
function somefunc()
{
stage.addChild(myMC)
[code].....
View 4 Replies
Apr 19, 2009
I have a very simple .fla. One frame, one button on the main stage. I have named the button and when I right click>actions, it says I can't put actions in this area. So then I put the Actions on the main timeline/keyframe. The code below works, but I can't get code to work in the button that I placed on the main stage. This button is dynamically placed by the first two lines of code.
Code:
var MyButton:ButtonOne = new ButtonOne();
MyButton.x = 100;
MyButton.y = 300;
addChild(MyButton);
MyButton.addEventListener(MouseEvent.MOUSE_DOWN,startMC);
function startMC(event:MouseEvent){
myMovieClip.gotoAndPlay(11);
}
If I try to just have the code that looks something like this..
Code:
ButtonOne.addEventListener(MouseEvent.MOUSE_DOWN, startMC);
//movie clip function startMC sits here..
I get an error saying the symbol doesn't exist.
View 8 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