A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: CS4 really.... Remove Child dilemma

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    8

    Exclamation CS4 really.... Remove Child dilemma

    Hi all....

    i'm trying to dynamically load in 3 photo galleries into a file. They are all SWF files. When you click the button for the thai gallery, it'll pop up. But if you want to navigate to the alex gallery, the thai gallery is still visible underneath. And the same problem with the 3rd gallery only all 3 are visible at this point. Is there a way to make these not visible?

    I'm using CS4 with ActionScript 3.0 (and ibuprofen for the headache this is giving me).

    I've got 3 seperate buttons set up for the 3 galleries. Is there a better method? I've tried using the removeChild(); but I don't think I've used it correctly as it throws errors all over the place when trying to use it.

    Any help would be VERY appreciated. My code is as follows and Thanks!!!

    Actionscript Code:
    thai_btn.addEventListener(MouseEvent.CLICK, loadImages);

    function loadImages(evtObj:MouseEvent):void {
        var imageLoader:Loader = new Loader();
        addChild(imageLoader);
        var url:URLRequest=new URLRequest("thaipix.swf");
        imageLoader.load(url);
        imageLoader.x=344;
        imageLoader.y=446.15;
        imageLoader.alpha=1;
    }


    haiti_btn.addEventListener(MouseEvent.CLICK, haitiImages);

    function haitiImages(evtObj:MouseEvent):void {
        var haitiLoader:Loader = new Loader();
        addChild(haitiLoader);
        var url:URLRequest=new URLRequest("haitipix.swf");
        haitiLoader.load(url);
        haitiLoader.x=344;
        haitiLoader.y=446.15;
    }


    alex_btn.addEventListener(MouseEvent.CLICK, alexImages);

    function alexImages(evtObj:MouseEvent):void {
        var alexLoader:Loader = new Loader();
        addChild(alexLoader);
        var url:URLRequest=new URLRequest("alexpix.swf");
        alexLoader.load(url);
        alexLoader.x=344;
        alexLoader.y=446.15;
    }

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    var imageLoader:Loader;
    imageLoader = new Loader();
    addChild(imageLoader);
    
    thai_btn.addEventListener(MouseEvent.CLICK, loadImages);
    function loadImages(evtObj:MouseEvent):void {
    	var url:URLRequest=new URLRequest("thaipix.swf");
    	imageLoader.load(url);
    	imageLoader.x=344;
    	imageLoader.y=446.15;
    	imageLoader.alpha=1;
    }
    haiti_btn.addEventListener(MouseEvent.CLICK, haitiImages);
    function haitiImages(evtObj:MouseEvent):void {
    	var url:URLRequest=new URLRequest("haitipix.swf");
    	imageLoader.load(url);
    	imageLoader.x=344;
    	imageLoader.y=446.15;
    }
    alex_btn.addEventListener(MouseEvent.CLICK, alexImages);
    function alexImages(evtObj:MouseEvent):void {
    	var url:URLRequest=new URLRequest("alexpix.swf");
    	imageLoader.load(url);
    	imageLoader.x=344;
    	imageLoader.y=446.15;
    }

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    8
    Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center