Quantcast
Viewing all articles
Browse latest Browse all 152999

Need to Disable to Button Until all the Elements of Array has been Displayed

Hi,

I have been getting alot of help from this Forum, thought of getting more out of it.I am very New to AS3 and trying my best to get as much as i can but still have some problems coming through.

 

I am trying to Disable the Button on a Specific Frame until all the Movie Clips in an Array are bieng Displayed , otherwise it should show another movie clip displying the message that all Movie Clips are not Displayed.

 

Here is the Scenario -

SUMMARY ///////

There are three Buttons on the Stage , Button for Next Frame , Button to Load 1st Movie Clip (note1), Button to load Second Movie Clip(note2)

I am counting the Movie Clips with Array Length (i am not sure if i am doing it right) but the idea is that once all the movie clips are loaded , Button for Next Frame should be enabled otherwise it should stay inactive, rather would display another movie clip as notice that All Movie Clips are not loaded)

 

 

Here is my Code.

 

import flash.events.MouseEvent;

btnnxt.mouseEnabled = false;

var note1:Mc_Notice1 = new Mc_Notice1;

var note2:Mc_Notice2 = new Mc_Notice2;

 

 

function next(Event:MouseEvent):void

{

  if(count.length == 2)

  {

  btnnxt.mouseEnabled = true;

  nextFrame();

  trace("mouse is Enabled");

  }

  else{

  btnnxt.mouseEnabled = false;

 

 

  }

 

}

 

var notes:Array = [note1,note2,note3];

var count:Array = new Array();

 

 

btnnxt.addEventListener(MouseEvent.CLICK , next);

 

 

 

 

 

 

btnload1.addEventListener(MouseEvent.CLICK , load1);

btnload2.addEventListener(MouseEvent.CLICK , load2);

 

 

 

 

function load1(Event:MouseEvent):void

{

 

 

  addChild(notes[0]);

  notes[0].x = 100;

  notes[0].y = 100;

  count.push(1);

  trace ("Count" + count.length);

  }

 

function load2(Event:MouseEvent):void{

 

 

  addChild(notes[1]);

  notes[0].x = 100;

  notes[0].y = 100;

  count.push(1);

  trace (count);

  //count0 = 1;

  trace (count.length);

  }

 

Please help in fixing this Error as i am not getting required results.

 

Please help.

 

Best Regards


Viewing all articles
Browse latest Browse all 152999

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>