1 Reply Latest reply on Feb 8, 2010 6:59 AM by kglad

    Converting to button Arrays

    danielnr87

      Basically, I have a FLVplayer called vidPlayer and 3 dynamic text fields that put text in when they are clicked.

      I want to be able to keep the button clicked in the 'over' state, and to do this I believe arrays are needed?

       

      Also, an array might be easier, as there is a lot of code to sift through.

       

      below is the code for the buttons in my flv;

       

       

      //video player script
      function fenwick(event:MouseEvent):void{
      vidPlayer.source = "flvs/adver/Fenwick.flv";
      }
      function moneyshopGold(event:MouseEvent):void{
      vidPlayer.source = "flvs/adver/MS_Liquid_Gold.flv";
      }
      function nottsplayhouse(event:MouseEvent):void{
      vidPlayer.source = "flvs/adver/Nottingham-playhouse.flv";
      }
      function severntrent(event:MouseEvent):void{
      vidPlayer.source = "flvs/adver/Severn-Trent.flv";
      }
      function IB_blists(event:MouseEvent):void{
      vidPlayer.source = "flvs/adver/IB_blists-hill.flv";
      }
      function IB_enginuity(event:MouseEvent):void{
      vidPlayer.source = "flvs/adver/IB_enginuity.flv";
      }
      function IB_placeexplore(event:MouseEvent):void{
      vidPlayer.source = "flvs/adver/IB_placetoexplore.flv";
      }
      function IB_greatyear(event:MouseEvent):void{
      vidPlayer.source = "flvs/adver/IB_great-year.flv";
      }

       

       

      //text script
      function fenwicktext(event:MouseEvent):void{
      textBoxTitle.text = "Fenwick";
      }
      function fenwicktext2(event:MouseEvent):void{
      textBoxName.text = "Sofa Sale";
      }
      function fenwicktext3(event:MouseEvent):void{
      textBoxDescription.text = "Fenwick’s Furniture Sales advertisement is an example of how a simple and effective, yet stylish TV ad can be created without breaking the bank.";
      }



      function moneyshopGoldtext(event:MouseEvent):void{
      textBoxTitle.text = 'The Money Shop';
      }
      function moneyshopGoldtext2(event:MouseEvent):void{
      textBoxName.text = "Gold to Cash";
      }
      function moneyshopGoldtext3(event:MouseEvent):void{
      textBoxDescription.text = "This was an advert for The Money Shop";
      }

      function nottsplayhousetext(event:MouseEvent):void{
      textBoxTitle.text = "Nottingham Playhouse";
      }
      function nottsplayhousetext2(event:MouseEvent):void{
      textBoxName.text = "Adverts";
      }
      function nottsplayhousetext3(event:MouseEvent):void{
      textBoxDescription.text = "This was an advert for";
      }

      function severntrenttext(event:MouseEvent):void{
      textBoxTitle.text = "Severn Trent";
      }
      function severntrenttext2(event:MouseEvent):void{
      textBoxName.text = "Broadband";
      }
      function severntrenttext3(event:MouseEvent):void{
      textBoxDescription.text = "This was an advert for";
      }

      function IB_bliststext(event:MouseEvent):void{
      textBoxTitle.text = "Ironbridge";
      }
      function IB_bliststext2(event:MouseEvent):void{
      textBoxName.text = "Blists Hill";
      }
      function IB_bliststext3(event:MouseEvent):void{
      textBoxDescription.text = "This was an advert for";
      }

      function IB_enginuitytext(event:MouseEvent):void{
      textBoxTitle.text = "Ironbridge";
      }
      function IB_enginuitytext2(event:MouseEvent):void{
      textBoxName.text = "Enginuity";
      }
      function IB_enginuitytext3(event:MouseEvent):void{
      textBoxDescription.text = "This was an advert for";
      }

      function IB_placeexploretext(event:MouseEvent):void{
      textBoxTitle.text = "Ironbridge";
      }
      function IB_placeexploretext2(event:MouseEvent):void{
      textBoxName.text = "A Place to Explore and Enjoy";
      }
      function IB_placeexploretext3(event:MouseEvent):void{
      textBoxDescription.text = "This was an advert for";
      }

      function IB_greatyeartext(event:MouseEvent):void{
      textBoxTitle.text = "Ironbridge";
      }
      function IB_greatyeartext2(event:MouseEvent):void{
      textBoxName.text = "A Great Year";
      }
      function IB_greatyeartext3(event:MouseEvent):void{
      textBoxDescription.text = "This was an advert for";
      }

       

       

      //event listeners
      scrollbox.content.btn_fenwick.addEventListener(MouseEvent.CLICK,fenwick);
      scrollbox.content.btn_fenwick.addEventListener(MouseEvent.CLICK,fenwicktext);
      scrollbox.content.btn_fenwick.addEventListener(MouseEvent.CLICK,fenwicktext2);
      scrollbox.content.btn_fenwick.addEventListener(MouseEvent.CLICK,fenwicktext3);

      scrollbox.content.btn_moneyshop_LG.addEventListener(MouseEvent.CLICK,moneyshopGold);
      scrollbox.content.btn_moneyshop_LG.addEventListener(MouseEvent.CLICK,moneyshopGoldtext);
      scrollbox.content.btn_moneyshop_LG.addEventListener(MouseEvent.CLICK,moneyshopGoldtext2);
      scrollbox.content.btn_moneyshop_LG.addEventListener(MouseEvent.CLICK,moneyshopGoldtext3);

      scrollbox.content.btn_nottsplayhouse.addEventListener(MouseEvent.CLICK,nottsplayhouse);
      scrollbox.content.btn_nottsplayhouse.addEventListener(MouseEvent.CLICK,nottsplayhousetext) ;
      scrollbox.content.btn_nottsplayhouse.addEventListener(MouseEvent.CLICK,nottsplayhousetext2 );
      scrollbox.content.btn_nottsplayhouse.addEventListener(MouseEvent.CLICK,nottsplayhousetext3 );

      scrollbox.content.btn_severntrent.addEventListener(MouseEvent.CLICK,severntrent);
      scrollbox.content.btn_severntrent.addEventListener(MouseEvent.CLICK,severntrenttext);
      scrollbox.content.btn_severntrent.addEventListener(MouseEvent.CLICK,severntrenttext2);
      scrollbox.content.btn_severntrent.addEventListener(MouseEvent.CLICK,severntrenttext3);

      scrollbox.content.btn_IB_blists.addEventListener(MouseEvent.CLICK,IB_blists);
      scrollbox.content.btn_IB_blists.addEventListener(MouseEvent.CLICK,IB_bliststext);
      scrollbox.content.btn_IB_blists.addEventListener(MouseEvent.CLICK,IB_bliststext2);
      scrollbox.content.btn_IB_blists.addEventListener(MouseEvent.CLICK,IB_bliststext3);

      scrollbox.content.btn_IB_enginuity.addEventListener(MouseEvent.CLICK,IB_enginuity);
      scrollbox.content.btn_IB_enginuity.addEventListener(MouseEvent.CLICK,IB_enginuitytext);
      scrollbox.content.btn_IB_enginuity.addEventListener(MouseEvent.CLICK,IB_enginuitytext2);
      scrollbox.content.btn_IB_enginuity.addEventListener(MouseEvent.CLICK,IB_enginuitytext3);

      scrollbox.content.btn_IB_placeexplore.addEventListener(MouseEvent.CLICK,IB_placeexplore);
      scrollbox.content.btn_IB_placeexplore.addEventListener(MouseEvent.CLICK,IB_placeexploretex t);
      scrollbox.content.btn_IB_placeexplore.addEventListener(MouseEvent.CLICK,IB_placeexploretex t2);
      scrollbox.content.btn_IB_placeexplore.addEventListener(MouseEvent.CLICK,IB_placeexploretex t3);

      scrollbox.content.btn_IB_greatyear.addEventListener(MouseEvent.CLICK,IB_greatyear);
      scrollbox.content.btn_IB_greatyear.addEventListener(MouseEvent.CLICK,IB_greatyeartext);
      scrollbox.content.btn_IB_greatyear.addEventListener(MouseEvent.CLICK,IB_greatyeartext2);
      scrollbox.content.btn_IB_greatyear.addEventListener(MouseEvent.CLICK,IB_greatyeartext3);

       

       

       

      Hope someone can help!

       

      Cheers

      Dan Williams