dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Changing pics 4 times...can't get more than 1 link to work

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    2

    Changing pics 4 times...can't get more than 1 link to work

    posted this in the noob section, as i am one. either it needed to be here, or there is such a thing as a stupid question, as i got no answers. :-)

    i am developing a piece for our home page that has three buttons below what's essentially a picture frame. the buttons work. it's the picture frame that doesn't.

    i have 4 ads that will rotate, each up for 250 frames. they fade out and in over each other. each has an instance name...ad1_link, ad2_link, etc. the idea is that as we have new products, etc, we'll swap in a new picture and remake the .swf.

    when i ran the code initially i got an 1120: access of undefined property error for pictures 2-4. no problems with the first one. after numerous attempts to find a solution, i decided to load all four movie clips at the same time, hiding them using the alpha property set to 0.

    i get no more errors, but now no matter which movie clip is visible, only the link to movie clip 4 (ad4_link) works. i need each clip to have it's own link, obviously, and for each to go away as the clip does.

    here's my code.

    var ad1:URLRequest=new URLRequest("/Pioneer_Professional_Multimedia_Player_p/pioneer-mep-7000.htm");
    var ad2:URLRequest=new URLRequest("/Roland_Shoulder_Synthesizer_p/roland-ax-synth.htm");
    var ad3:URLRequest=new URLRequest("/Amplifiers_s/75.htm");
    var ad4:URLRequest=new URLRequest("/Samson_Portable_PA_System_p/samson-xp308i.htm");


    function ad1Down(event:MouseEvent):void{

    navigateToURL(ad1, "_self");
    }


    function ad2Down(event:MouseEvent):void{

    navigateToURL(ad2, "_self");
    }


    function ad3Down(event:MouseEvent):void{

    navigateToURL(ad3, "_self");
    }


    function ad4Down(event:MouseEvent):void{

    navigateToURL(ad4, "_self");
    }


    ad1_link.addEventListener(MouseEvent.CLICK, ad1Down);
    ad2_link.addEventListener(MouseEvent.CLICK, ad2Down);
    ad3_link.addEventListener(MouseEvent.CLICK, ad3Down);
    ad4_link.addEventListener(MouseEvent.CLICK, ad4Down);



    thanks in advance for your help

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I'm guessing that all your links work, but you are clicking on ad4 the whole time because it is on the top, even when it's invisible.

    When you activate a new clip, try bringing it to the top by calling addChild(clip) again where clip is the one you are setting alpha=1.

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