External SWF Disappears on Browser resize

I am loading external swf's inside content_2 and when i resize my browser the external content OR content_2 disappears. Can someone help me as to what I need to do to stop this. I've tried adding an onresize function but that does not work. Here my as3 code:
scroll_sb2.scrolling("content_2", "area_2", 0.18); // Range from 0.00 to 1.00
stage.addEventListener(Event.RESIZE, resizeHandler);
function resizeHandler(e:Event):void
scroll_sb2.x = stage.stageWidth - scroll_sb2.width - 2;
scroll_sb2.y = 0;
scroll_sb2.height = stage.stageHeight;
area_2.x = stage.stageWidth/2 - area_2.width/2;
area_2.y = stage.stageHeight/2 - area_2.height/2;
area_2.y = 0;
area_2.height = stage.stageHeight;
content_2.x = stage.stageWidth/2 - content_2.width/2;
content_2.y = stage.stageHeight - content_2.height;  // comment this line if you whant to remove the carrusel affect on resize browser
backgroundMC.x=0;
backgroundMC.y=0;
backgroundMC.width=stage.stageWidth;
backgroundMC.height=stage.stageHeight;
downbg_mc.x = 0;
downbg_mc.y = 0;
downbg_mc.width = stage.stageWidth;
stage.align = StageAlign.TOP_LEFT;     
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.dispatchEvent(new Event(Event.RESIZE));
var mem:String = Number ( System.totalMemory / 2048 / 2048 ).toFixed ( 2 ) + 'Mb';
trace ( mem ); 

Guys can you PLZZZ Help me out with this. I've been researching this ALL day with no solution, I'v
e posted this in THREE forums and I havent gotten ONE response. Plz assist me!
ALSO..This is the action script that's in my scrollbar movie:
var sd:Number;
var sr:Number;
var cd:Number;
var cr:Number;
var new_y:Number;
var drag_area:Rectangle;
var scroll_content:MovieClip;
var scroll_content_area:MovieClip;
var scrolling_speed:Number; // 0.00 to 1.00
//.............. SCROLL BUTTON .............//
scroll_scroller.buttonMode = true;
addEventListener ( MouseEvent.MOUSE_OVER, mouse_over );
addEventListener ( MouseEvent.MOUSE_OUT, mouse_out );
function mouse_over ( event:MouseEvent ) {
  scroll_scroller.alpha = 0.7;
function mouse_out ( event:MouseEvent ) {
  scroll_scroller.alpha = 1;
//.............. END scroll button...........//
function scrolling( ct:String, ct_area:String, speed:Number ):void
scrolling_speed = speed;
if( scrolling_speed < 0 || scrolling_speed > 1 ) scrolling_speed = 0.50;
scroll_content = parent[ct];
scroll_content_area = parent[ct_area];
scroll_content.mask = scroll_content_area;
scroll_content.x = scroll_content_area.x;
scroll_content.y = scroll_content_area.y;
scroll_scroller.x = scroll_scrollable_area.x;
scroll_scroller.y = scroll_scrollable_area.y;
sr = scroll_content_area.height / scroll_content.height;
scroll_scroller.height = scroll_scrollable_area.height * sr;
sd = scroll_scrollable_area.height - scroll_scroller.height;
cd = scroll_content.height - scroll_content_area.height;
cr = cd / sd * 1.01;
drag_area = new Rectangle( 0, 0, 0,scroll_scrollable_area.height -  scroll_scroller.height );
if ( scroll_content.height <= scroll_content_area.height )
  scroll_scroller.visible = scroll_scrollable_area.visible = false;
scroll_scroller.addEventListener( MouseEvent.MOUSE_DOWN, scroller_drag );
scroll_scroller.addEventListener( MouseEvent.MOUSE_UP, scroller_drop );
this.addEventListener( Event.ENTER_FRAME, on_scroll );
function scroller_drag( me:MouseEvent ):void
me.target.startDrag(false, drag_area);
stage.addEventListener(MouseEvent.MOUSE_UP, up);
function scroller_drop( me:MouseEvent ):void
me.target.stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, up);
function up( me:MouseEvent ):void
scroll_scroller.stopDrag();
function on_scroll( e:Event ):void
new_y = scroll_content_area.y + scroll_scrollable_area.y * cr - scroll_scroller.y  * cr;
scroll_content.y += ( new_y - scroll_content.y ) * scrolling_speed;
// END

Similar Messages

  • Getting external swf to stay visible?

    Hi
    I have an external swf that contains a button that controls my main swf's timeline.
    I can get it to navigate fine, but as soon as it navigates, my external swf disappears, because my main swf is no longer on the frame my external swf was imported on.
    How do I get the external swf to stay visible along all the frames of my main swf's timeline?
    Here's the code I use to import the external swf:
    var external_swf:MovieClip;
    var loader:Loader = new Loader();
    var import_me_SWF:URLRequest = new URLRequest("external_mc.swf");
    loader.load(import_me_SWF);
    loader.x = 0;
    loader.y = 0;
    addChild(loader);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, dataOnLoad);
    function dataOnLoad(evt:Event): void {
    external_swf = MovieClip(evt.target.content);
    Thanks guys.
    Shaun

    SOLUTION:
    Ok - here's a solution I experimented with for anyone that needs a similar fix:
    1. Create a new layer where you would like the external swf to go (in my case, the layer is on the top).
    2. Draw a rectangle (doesn't matter what it is really), convert it to a movieclip symbol, and give it a color effect APLHA of 0 so it's invisible.  Give it an instance name - I named mine 'external_swf_holder'
    3. Adapt the external loader code like this...add 'external_swf_holder' to the beginning of the external clip name, with a dot in between:
    var external_swf:MovieClip;
    var loader:Loader = new Loader();
    var  import_me_SWF:URLRequest = new URLRequest("external_mc.swf");
    loader.load(import_me_SWF);
    loader.x  = 0;
    loader.y = 0;
    addChild(loader);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,  dataOnLoad);
    function  dataOnLoad(evt:Event): void {
    external_swf_holder.external_swf =  MovieClip(evt.target.content);
    4. That's it.  Now Flash should always keep your swf on the layer that 'external_swf_holder' is on.
    Cheers
    Shaun

  • Loading external swf / resizing

    Hi,
    I'm loading external swf into my main project for sub sections to keep size down.  My main project is 1280 x 700px in size.
    In those sub-section I have some content with a scroller.
    When I load the swf and check the size its ok. But as soon as the scrollbars is initialized scroll bar is initialized the size of the external includes the text that goes off-stage for the sroller.
    I can resize it propotionaly when after its loader because i have the correct values. But if the user resizes his browser I get the wrong values and my resize code doesnt work because it's height is now incorrect.
    So is there a way to not include the off-stage elements to count as the height ?

    either hard-code that loaded swf's stage size or use code to determine that size in a frame before any off-stage content is added.

  • Stage Resizing on "Clicked" External SWFs

    Hello everyone!
    Thanks for checking this out.
    This has been bugging me for almost a week now. I hope I may find some assistance here. I've Googled for this and everytime I encounter an article with the solution and people saying it worked great for them, I thought it's going to help me too, but didn't. I'm pretty sure I did exactly what was instructed but mine is just weird.
    I hope you can try to look at my files and see what's wrong, anyway this is just a simulation of my real project (which has the same problem) at a very small scale so it should be very easy to look at. I believe it's so easy to solve but I just couldn't nail it. Here's a brief description:
    There's this main.swf that loads two external swfs in a UILoader upon click of the corresponding button. By the way, the code inside the external swfs listens for a stage resize... So, when user clicks on button 1 (named "LOAD 1"), it loads "content1.swf". User decides to resize the window, and layout resizes accordingly (in this case, they all center horizontally). User clicks on button 2 (named "LOAD 2"), it loads "content2.swf". Everything looks fine, apparently. But when user tries to resize the window again, an error pops up in the Output panel...
    Honestly, I've built a new one here at my desktop using var loader:Loader = new Loader(); concept instead of the UILoader Flash component but still no luck. Please, hear me out. I don't think I want to give up.
    Thanks!

    Try this:
    Rename setComp() and resizeComp() in content1 to setComp1() and resizeComp1()
    Rename setComp() and resizeComp() in content2 to setComp2() and resizeComp2()
    Now try resizing and you'll see the error being thrown with the new function names.
    I think your problem deals with unloading your content. You should maybe try to properly unload content1 before loading content2 and vs. versa and see if that fixes your problem. I suspect that the resizeComp2 is still trying to resize an object that doesn't exist on the stage anymore, but the function is still loaded into memory and running. Unloading your swfs might clear this up.

  • Component Loader resizing external swfs

    Hi. Fairly new to Flash. I'm putting together my first full
    Flash site. The tutorial I'm following along with for some
    assistance is written for Flash8, but I'm using CS3. To try to
    minimize differences, I'm doing my files in Actionscript 2.
    I've used an instance of the component Loader to load
    external swfs (my pages) into the content portion of my main swf.
    The problem I've run into is the loaded swfs are showing up at
    different sizes. For ease of layout, the document sizes of the
    external swfs are exactly the same as the mx.controls.Loader
    instance on my main swf. But when they load, one is coming in
    slightly larger than the original size, one nearly a quarter of the
    size it should be. Everything else works.
    In playing around to try to troubleshoot, I made one change
    to my home swf (the external that loads immediately with a
    Loader.contentPath command. This one had been loading slightly
    enlarged), I changed a guide layer so it was a regular layer, no
    longer a guide, then it loaded at the right size. When I changed
    the layer back to a guide, it loaded somewhat enlarged again. I
    tried turning off the guide layer on the other swf that was loading
    small, it didn't help. I'm going nuts trying to figure it out.
    I thought maybe it might have to do with the fact that some
    elements start outside the document frame of the external swfs and
    slide in, so I masked all layers to the size of the document. That
    didn't help. Is there some scale setting for the Loader component
    that I'm not aware of? That would cause the external swf to scale
    up or down to fit the size of the Loader instance?
    Any help would be appreciated. Thanks

    Thanks. I tried a few more searches in Flash's Help for
    Loader scaling and resize and found the scaleContent property, was
    just coming back here to say nevermind and saw your response.
    Sometimes it takes writing out the problem to spark more
    troubleshooting inspiration.
    BTW, changing Loader.scaleContent to false did solve my
    problem. :)

  • External SWF gets resized

    I'm using the code below in a movieclip in Flash CS3 to
    import an external swf into my project. However, every time I
    upload the site to the server (
    http://www.kimandbrett.com),
    when I click on Gallery, the Gallery.swf is stretched out & the
    image is too big. I tried uploading the same exact thing to
    http://www.personal.kent.edu/~nglase/FlashSite/index.html
    & it works just fine. The site that is not working is hosted by
    GoDaddy. Are there any server settings that might be causing it to
    behave differently?
    Thanks,
    Natalie

    stage.StageScaleMode.NO_SCALE;
    /* put this line in all your code */
    The entire Flash application is fixed, so that it remains
    unchanged even as the size of the player window changes. Cropping
    might occur if the player window is smaller than the content.

  • Remove / unload external swf file(s) from the main flash file and load a new swf file and garbage collection from memory.

    I can't seem to remove / unload the external swf files e.g when the carousel.swf (portfolio) is displayed and I press the about button the about content is overlapping the carousel (portfolio) . How can I remove / unload an external swf file from the main flash file and load a new swf file, while at the same time removing garbage collection from memory?
    This is the error message(s) I am receiving: "TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/removeChild()
    at index_fla::MainTimeline/Down3()"
    import nl.demonsters.debugger.MonsterDebugger;
    var d:MonsterDebugger=new MonsterDebugger(this);
    stage.scaleMode=StageScaleMode.NO_SCALE;
    stage.align=StageAlign.TOP_LEFT;
    stage.addEventListener(Event.RESIZE, resizeHandler);
    // loader is the loader for portfolio page swf
    var loader:Loader;
    var loader2:Loader;
    var loader3:Loader;
    var loader1:Loader;
    //  resize content
    function resizeHandler(event:Event):void {
        // resizes portfolio page to center
    loader.x = (stage.stageWidth - loader.width) * .5;
    loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    /*loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;*/
    addEventListener(Event.ENTER_FRAME, onEnterFrame,false, 0, true);
    function onEnterFrame(ev:Event):void {
    var requesterb:URLRequest=new URLRequest("carouselLoader.swf");
    loader = null;
    loader = new Loader();
    loader.name ="carousel1"
    //adds gallery.swf to stage at begining of movie
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requesterb);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    // stop gallery.swf from duplication over and over again on enter frame
    removeEventListener(Event.ENTER_FRAME, onEnterFrame);
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent):void {
    // re adds listener for contact.swf and about.swf
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
    var requester:URLRequest=new URLRequest("carouselLoader.swf");
        loader = null;
    loader = new Loader();
    loader.name ="carousel"
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    removeChild( getChildByName("about") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of gallery.swf
    MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    function Down1(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    var requester:URLRequest=new URLRequest("contactLoader.swf");
    loader2 = null;
    loader2 = new Loader();
    loader2.name ="contact"
    loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader2.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader2);
    loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    function Down3(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    var requester:URLRequest=new URLRequest("aboutLoader.swf");
    loader3 = null;
    loader3 = new Loader();
    loader3.name ="about"
    loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader3.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader3);
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    removeChild( getChildByName("carousel") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
    stop();

    Andrei1,
    Thank you for the helpful advice. I made the changes as you suggested but I am receiving a #1009 error message even though my site is working the way I wan it to work. I would still like to fix the errors so that my site runs and error free. This is the error I am receiving:
    "TypeError: Error #1009: Cannot access a property or method of a null object reference."
    I'm sure this is not the best method to unload loaders and I am guessing this is why I am receiving the following error message.
         loader.unload();
         loader2.unload();
         loader3.unload();
    I also tried creating a function to unload the loader but received the same error message and my portfolio swf was not showing at all.
         function killLoad():void{
         try { loader.close(); loader2.close; loader3.close;} catch (e:*) {}
         loader.unload(); loader2.unload(); loader3.unload();
    I have a question regarding suggestion you made to set Mouse Event to "null". What does this do setting the MouseEvent do exactly?  Also, since I've set the MouseEvent to null do I also have to set the loader to null? e.g.
    ---- Here is my updated code ----
    // variable for external loaders
    var loader:Loader;
    var loader1:Loader;
    var loader2:Loader;
    var loader3:Loader;
    // makes borders resize with browser size
    function resizeHandler(event:Event):void {
    // resizes portfolio page to center
         loader.x = (stage.stageWidth - loader.width) * .5;
         loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
    //adds gallery.swf to stage at begining of moviie
         Down();
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent = null):void {
    // re adds listener for contact.swf and about.swf
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
         var requester:URLRequest=new URLRequest("carouselLoader.swf");
         loader = new Loader();
         loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader.load(requester);
         } catch (error:SecurityError) {
         trace(error);
         this.addChild(loader);
         loader.x = (stage.stageWidth - 739) * .5;
         loader.y = (stage.stageHeight - 500) * .5;
    // sure this is not the best way to do this - but it is unload external swfs
         loader.unload();
         loader2.unload();
         loader3.unload();
    // remove eventlistner and prevents duplication of gallery.swf
         MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         function Down1(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         var requester:URLRequest=new URLRequest("contactLoader.swf");
         loader2 = null;
         loader2 = new Loader();
         loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);    
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader2.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader2);
         loader2.x = (stage.stageWidth - 658.65) * .5;
         loader2.y = (stage.stageHeight - 551.45) * .5;
    loader.unload();
    loader2.unload();
    loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         function Down3(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         var requester:URLRequest=new URLRequest("aboutLoader.swf");
         loader3 = null;
         loader3 = new Loader();
         loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader3.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader3);
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
         loader.unload();
         loader2.unload();
         loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
         stop();

  • Addchild browser resize

    Hey Guys! I got my external swf to center...However, when I resize my browser the external swf dissapears off the screen (I can still hear it's music though) Anybody have any suggestions? Heres my class code:
    package {
         import flash.display.Sprite;
         import flash.display.Loader;
         import flash.net.URLRequest;
         import flash.events.Event;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
         public class Main extends Sprite{
              private var container:Sprite;
              public function Main(){
                   container = new Sprite();     
                   this.addChild(container);
                   var url:URLRequest = new URLRequest("index2.swf");
                   var loader:Loader = new Loader();
                   loader.load(url);
                   loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
                   this.stage.scaleMode = StageScaleMode.NO_SCALE;
                this.stage.align = StageAlign.TOP_LEFT;
              private function completeHandler(event:Event):void{               
                   this.addChildAt(bg,0)
                   this.container.addChild(event.target.content);
                   this.container.x = this.stage.stageWidth/2 - event.target.width /2;
                   this.container.y = this.stage.stageHeight/2 - event.target.height /2;
                   bg.width = stage.stageWidth;
                   bg.height = stage.stageHeight;
                   bg.x = 0
                   bg.y = 0
                   this.stage.addEventListener(Event.RESIZE, resizeHandler);
              private function resizeHandler(event:Event):void{
                   this.addChildAt(bg,0)
                   this.container.x = this.stage.stageWidth/2 - event.target.width /2;
                   this.container.y = this.stage.stageHeight/2 - event.target.height /2;
                   bg.width = stage.stageWidth;
                   bg.height = stage.stageHeight;
                   bg.x = 0
                   bg.y = 0

    try:
    private function resizeHandler(event:Event):void{
                   this.addChildAt(bg,0)
                   this.container.x = this.stage.stageWidth/2 - event.target.width /2;
                   this.container.y = this.stage.stageHeight/2 - event.target.height /2;
                   bg.width = stage.stageWidth;
                   bg.height = stage.stageHeight;
                   bg.x = 0
                   bg.y = 0
                   addChild(container); // <-  added

  • Open external swf from within another external swf?

    Hello, I'm relatively new to AS3 and have a problem that I'd like to see if anyone can provide a response.
    I have an external swf that is opened through a web page, but the swf does not diplay in a web page, we use javascript to remove the browser, control the window size to 1024X710, no scrollbars, etc. Within that external swf I want to use a button that the user can click to open a separate external swf that is located in the same folder; however, I want it to display as the original swf (without it being displayed in an Internet browser, no scroll bars, a certain size 1024X710), etc. I've been able to find script where you can open an external web page with a certain size window; however, I find nothing regarding how to open an external swf with conditions.
    Any help you can provide would be greatly appreciated!
    We use this script on a web page to open the external swf:
    <script language="Javascript">
      function openSWF1(cbtFile)
        window.open(cbtFile,"NewWindow","toolbar=no,directories=no,menubar=no,scrollbars=yes,widt h=1024,height=710");
    </script>
    We use the following html code to call the JS and open the applicable swf file:
    <a href="javascript:openSWF1('CBT/AppTrng/EIP-New-Siebel.swf')">Enterprise Image Processing (EIP)</a>

    Hi,
    I found this function and it works correctly; however, it seems to automatically move the movie to the next frame instead of staying on the same frame in which the function is displayed.
    The first function is to move to the next frame when the user presses the Tab key on their keyboard.
    stage.addEventListener(KeyboardEvent.KEY_DOWN, cool);
    function cool(e:KeyboardEvent):void {
          if(e.keyCode == Keyboard.TAB){
               gotoAndPlay("7");
    This function is to open an external swf in a sizeable window with no Internet window - it works great! However, it automatically navigates the parent movie clip to frame #7. What am I doing wrong?
    query_btn.addEventListener(MouseEvent.CLICK, MYBUTTON_link8);
    function MYBUTTON_link8(e:MouseEvent):void
        //navigateToURL(new URLRequest("icb.swf"), "_blank", "scrollbars=no,titlebar=no,toolbar=no,menubar=no,resizable=yes,width=1024,height=710");
    var gameURL:String = "http://opstraining.bcbsfl.com/NonPMI/RBMS/icb.swf";
    var jscommand:String = "window.open('"+gameURL+"','win','width=1024,height=710,toolbar=no,scrollbars=no,location =no,status=no,menubar=no');";
    var url:URLRequest = new URLRequest("javascript:" + jscommand + " void(0);");
    navigateToURL(url, "_self");

  • What is or isn't possible on iOS?  (Not having Loader, loadBytes(), external swfs, etc)

    My basic question is:  "What are the classes which we should not use for iOS using the packager."
    I have been trying for a few days trying to get a simple Flash app to run on the iPad.  A very simple app (with sound!) with just 2 classes works fine (Performance is a whole other issue.  We will get to that).  But if I try anything else, all I get is a white/black screen on the iPad.  So it would be really nice to know what classes, functions, etc we CANNOT use for the Packager.
    I have fairly simple app (not as simple as 2 classes) which loads some art assets via URLRequest/Loader, puts them on the stage.  Fairly common standard practice in AS3.
    I've read about not able to load an external file using the Packager.  So to fix the situation of loading assets, I have looked into the [embed] tag, which seems to work.  I hope the blogger doesn't mind, but this page is an excellent source on what works and doesn't work with the [embed] tag in it's various flavors:  http://www.richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asse t_workflows.  For example, AS3 in a swf is stripped out from an external swf using [embed].
    The best way to load an external swf file for iOS seems to be using [embed] with "application/octet-stream" and load the swf through ByteArray (Option #4 in the link above).  This works great on the PC.  HOWEVER, on iPad, it fails.  The [embed] tag works on the iPad with the other ways, so my guess is that loadBytes() does not work.  Is this true Adobe/Flash guys?  Can you confirm this?
    My initial question is "why is this not allowed on iOS?".  If it is because of the fact that it uses a Loader, can it be changed so it's not using a Loader to construct a MovieClip?  I have a ByteArray with the raw swf/MovieClip data.  Why can't I construct a MovieClip from it without going through Loader?
    This loadBytes() failure seems to be the only thing preventing me from using the normal pipeline of Flash development in loading external assets.  If there are other ways people have found, please share!
    Now on to performance.  Adobe, can you post some examples/samples of code which runs at decent performance?  Like a "tech demo" of what is possible using the Packager running on iPad/iPhone.  That would be extremely helpful for everyone.  I have done a lot of the optimizing suggestions on various sites and pages ( and by Adobe http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html), but I am not seeing the 30 fps performance that is MORE than possible on iPhone/iPad.  Displaying and moving around Bitmaps (I don't use any vector graphics) should be blazing fast.  Quake runs on iPad without any problems and that code is 10 years old.  Moore's law dictates that drawing Bitmaps using CPU should be faster than a 3D engine written 10 years ago...  I am trying out the new iOS 4.2 which is supposed to be "significantly" better, but I am still stuck on loadBytes().
    So at this point, I am blocked on loadBytes() and my performance for a simple app which draws a few Bitmaps and MovieClips is terrible.  I am hopeful some people out there have figured out some solution (there are lots of clever people out there) and I will stumble on to something.  But being forced to go native Objective-C seems to be my only option at this point.
    In summary, here are the questions I would like to ask the Adobe/Flash group for some more help/information/advise:
    - Why is Loader not allowed on iOS?  Is it a technical limitation of the hardware/os/Flash?  Will it never be supported?  What is the future of this class on iOS?
    - Why is loadBytes() not allowed on iOS?  I have the raw embedded data in memory.  I don't need to make a remote call so security should not be an issue.  Can I create a MovieClip without using Loader?
    - Why is AS3 stripped from the timeline when a Symbol is retrieved using [embed]?  Maybe this is the same reason loadBytes() fails, but if I could use [embed] and get a copy of the Symbol, that is what I need.  (There are issues with the mx.core.MovieClipLoaderAsset/Asset, but it is better than being blocked by loadBytes())
    - What are some apps you guys have written that we can use to compare PC vs iOS?  Again, a "tech demo" or sample code of what you as experts in Packager for iOS have done which runs at decent framerate (30+fps) would be of tremendous help.  If the Adobe/Flash group hasn't gotten the current Packager for iOS to handle more than 50+ 2D Bitmaps on screen running at 30+fps, that would be good to know.  Please let us know what the experts and owners of your software are capable of getting the most throughput using the Packager.  I'd hate to sound a bit fed up/angry, but I think you are wasting a lot of people's time and energy with a piece of software that, to me, seems like it was a bit early to release.  Flash can do some great things.  If it can do it on iOS, even better.  But PROVE it to us that it's possible, before having your customers run into barriers imposed on us by trial and error.
    Thanks.

    I have hardly ever seen a post here from someone at Adobe, so you may need to be patient.
    Read this article, and get its associated demo files, to see some good performing tech demos:
    http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html
    Back to your main point, loaders are working, what isn't working for you is accessing of things in the library of a successfully loaded swf, that have been set to Export for ActionScript. That means that the swf you have loaded has an ActionScript Class, to represent the library symbol. iOS Flash apps are native ARM code, and don't include the virtual machines that a browser plugin has, and so it's not able to interpret ActionScript. That may be why it would fail.
    Now, I can think of at least a couple of reasons why you might want to have external swfs with elements that you want to reuse in the main swf. One would be if you're intending to make a lot of them, like say if you wanted to have an Asteroids game and the ability to use artwork from a set of different swfs. Another reason might be if you want to skin your interface, by taking specific elements from the loaded swf and using them in the main swf. That way you could have artists preparing those swfs for you, and you just include them in your package, and load the one you want.
    There is a way to do either of those things. The second one can be done by having the item as a named symbol on the stage of the loaded swf. With a to-be-loaded swf named "inner.swf", that has a movieclip on its stage named "mc1", this script in the main swf would load that external swf and use its symbol on the main swf's stage, without having to make the inner swf's symbol use ActionScript:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    For the other case, you can take the item off the stage of the loaded swf and draw it into a bitmapdata, and then make as many bitmaps from that as you like. Here's the above example, only it adds the original movieclip to the main swf stage, and also creates a bitmap that looks the same:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    var bmd:BitmapData = new BitmapData(innermc.width,innermc.height);
    bmd.draw(innermc);
    var bm:Bitmap = new Bitmap(bmd);
    bm.x = 150;
    bm.y = 150;
    addChild(bm);
    So, the thing to learn is that a native ARM code application does not have an ActionScript interpreter in it, and if you need to do something that normally requires interpreting ActionScript, find another way to do it.

  • How to control timeline sound of external SWF

    Hi All,
    Basic Intro:
    I am new in Action Script and trying to create a video tutorial framwork. In this I have lots of animated SWF files in all the files I have multiple scenes as those are 5min. to 10 min. each and all the files have the relevent background and nurration voice place directly on the TIMELINE frame by frame to match lip syncing animated chreactors.
    My file structure :
    Login.swf with login box is embedded into the Index.html
    After logged in it will load another SWF which is Control panel.swf
    3. Controlpanel.swf has the controls to control the loaded external swf files i.e.: Chapter menu, Play, pause, replay, volume-bar, next and previous buttons.
    By Default Controlpanel.swf will open chapter1.swf as soon as user logged in so no one need to open 1st file.
    Here user can navigate to other chapter swf file through Chapter menu or Next and Previous buttons.
    All files are loading and playing properly, here I am trying to control the animation and Sound both at a same time with Pause, Play and Replay through relevant buttons.
    Problem:
    By pressing “Pause button” animation stops but not the sound. Sound remains playing, and if I replay the swf by “Replay button” than animation restarts but sound also restarts that overlaps already playing audio.
    Question: So could anybody help me finding out how to:
    1. Pause the sound with animation by the same click of Pause button, and
    2. Stop the sound with animation by the same click of Stop button, and
    3. On replay it should stop playing the previously running audio and restart it with the animation like fresh loaded file, it should not sound overlapping.
    Constraints:
    Here I am using the sound file on the same time line of each individual swf file which I cannot add into any single movie clip because all the chapter swf file are having multiple scenes in it.
    For my problem I have already done a lot of browsing online in various forums and didn't find the solution. So here I am sharing the complete information regarding the project and wishing to get some good solution out here but if I missed any helpful information please ask me anytime and please help me to quickly find out the solution.
    Thanks a lot to all of you in advance to help me.

    create one global sound variable
    you can write when you are pressing pause button
    globalsoundvariable.setVolume(0)
    to play
    globalsoundvariable.setVolume(100)

  • FAQ: How do I load an external SWF file into a parent SWF file?

    A ton of Flash users visit Adobe’s we site every month wondering  about how to load an external SWF file from within another SWF.
    Adobe's own TechNote on the subject attempts to answer the basic question, along with some common follow-up questions, including:
    How do I load more than one SWF?
    How do I load a SWF into a specific location in the display list?
    How do I resize the loaded SWF?
    How do I set its X and Y location?
    Here are some additional resources that elaborate on loading content and on working with the display list:
    Sample files for the above TechNote. A set of 3 FLA and 3 corresponding SWF files, including a parent SWF and 2 SWFs that the parent loads.
    Help > AS3 Developer’s Guide > Loading an external SWF file
    Help > AS3 Developer’s Guide > Loading display content dynamically
    Loading multiple external SWFs within a main SWF – CreativeCow.net forums
    Video tutorial: ActionScript 101 – Episode 6: Adding named objects to the Stage. By Doug Winnie. An example of how to add the loaded external asset to the Stage and modify its location or other properties.
    Video tutorial: Preloading in ActionScript 3.0.  By Lee Brimelow. A slightly more complicated example, showing how to  make the parent SWF display information about the progress of loading  the external SWF.
    Tutorial: Loading and unloading SWFs - FlashAndMath.com
    This article provides several examples of how to communicate between a parent SWF file and the loaded SWF:
    SWF to SWF Communcation via ActionScript 3.0 (by kglad)

    quote:
    Originally posted by:
    NedWebs
    You now seem to want to get rid of the swf once it has loaded
    and played itself thru. To do that you would need to have something
    in the swf itself that triggers its removal in its last frame. The
    following might work...
    MovieClip(this.parent).removeChild(this);
    Unfortunately I couldn't get this to work. I placed it on the
    last frame of the SWF to be called - is that right?
    I am not sure I am doing it correctly...

  • Loading an external SWF in and displaying it behind overlay/watermark

    I am building a SWF and the goal is to load in an external SWF file and then display that within my container. They are totally unrelated items and I do not want to modify the functionality of the item I am loading in. My SWF will briefly display a watermark overlay, but then disappear. Can anyone guide me into this best way of doing this?
    Also, is there anyway to get the properties from the SWF I loaded in (namely height and width) so I might be able to easily adjust the size of my SWF to match?
    Thanks!

    just load your external swf using the loader class.  what you described doing is standard stuff and nothing special needs to be done.
    however, you must wait until loading is complete before you can access the loaded object's width and height.

  • Loading an external .swf into an empty container

    I'm loading an external .swf into an empty container.
    Everything seems to work fine except when the .swf is loaded both
    seems to be running extremely sluggish. The button rollovers are
    slow, the page transitions..everything. I can't figure out why it
    is doing this. Both .fla's have the same frame rate. Is there some
    known reason why this might happen?

    well, we've tried that and it is actually a little bit worse.
    Normally i test everything in a browser window anyway. I'm thinking
    it might be a naming issue of some variable or something that is
    the same for both fla's....not sure yet though.

  • MouseEvent and external SWF

    I'm loading an external SWF to use as a "skin" (no components
    are involved, only MovieClips). The external SWF contains a number
    of MovieClips, each exported for Actionscript and with an
    associated class. One of these classes is, for example, called
    "Thing1".
    I'm successfully loading the SWF using Loader, etc. - I'm
    also setting its ApplicationDomain to that same one as the loading
    SWF. I can then successfully create an instance of Thing1 and add
    it to a child MovieClip of the loading SWF. All is good.. the
    problem occurs when I try to add an event listener to the instance
    of Thing1 - the event doesn't trigger.
    Here are some curious facts: IF Thing1 consists only of
    graphics, ie. no child MovieClips, then the event DOES trigger.
    Also, if I add an event listener, not to a child of Thing1, but to
    a child of a child of Thing1, then it works. BUT, a mouse event
    added to the stage of that MovieClip doesn't trigger.
    There seems to be some problem with mouse events bubbling
    across the "boundary" between Thing1 and the loading SWF.
    Anyone??

    Ha.. in the process of preparing simplified code, I figured
    out the problem. I'm developing locally, and I was loading the
    external SWF via localhost, eg.
    http://localhost/skin.swf. If
    I instead load skin.swf, the problem disappears (I was using
    localhost because I'm also loading data via PHP scripts). Thank you
    kglad, for indirectly helping me find the solution ;)

Maybe you are looking for

  • How to monitor network shares availability ?

    I have to develop indicators of availability.  I planned to create distributed applications for each indicator and generate reports.  On some applications, I have to watch the availability of a network share.  Have you already monitor shares availabi

  • ICloud password expired

    Hello! Recently I updated my AppleTV (3rd gen) to the latest software but my Photo Stream was not working. It told me I needed to put in my password again. Upon entering it, the AppleTV claimed my password was incorrect. While I know many will say th

  • Blackberry Media Sync Failed To Initialize - Run With Administrative Privileges

    I've downloaded the Blackberry Desktop Manager (4.7) and everything works fine except for the Blackberry Media Sync which fails to initialize and needs to be run with administrative privileges.  Anyone experience this and how did you correct the admi

  • Why Can't I create an Appointment using this C# code?

    I have the following C# code and I'm getting an error (see below). Can anyone tell me what I am missing and why would I get an error at this point in the code? public static void Test() GroupwareTypeLibrary.Application groupwiseApp; GroupwareTypeLibr

  • SPA scale options on SIP-400

    Hi All, Are there any scalability limitations on 7600 with a SIP-400 module? Specifically looking for pointers in identifying the maximum number of 1xGig ports supported per SIP-400 on a 7600 router. Thanks ~sultan