Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Actionscript 2.0 Movie Clip Variable Array help

New Here ,
Apr 21, 2014 Apr 21, 2014

I just want to use multiple attached movie clip as array, btw this is the simple code :

if(_global.plevel == 0)
{
           var box1:MovieClip = _root.attachMovie("flip_box_lg", "fb1",  this.getDepth()+5,{_x:100,_y:100});
           box1._width = 100;
           box1._height = 40;
           box1._x = 60;
           box1._y = 80;
           var box2:MovieClip = _root.attachMovie("flip_box_lg", "fb2",  this.getDepth()+6,{_x:100,_y:100});
           box2._width = 100;
           box2._height = 40;
           box2._x = 170;
           box2._y = 80;
           this.onEnterFrame=assignF;
}

can I just making it like this ?

for(var i=0;i<6;i++)
{
      var box:MovieClip = _root.attachMovie("flip_box_lg", "fb"+(i+1),  this.getDepth()+5,{_x:60+(i*110),_y:80});
}

Thank you before

TOPICS
ActionScript
674
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 21, 2014 Apr 21, 2014

use:

var box:Array=[];

for(var i=0;i<6;i++)
{
      box.push( _root.attachMovie("flip_box_lg", "fb"+(i+1), _root.getNextHighestDepth(),{_x:60+(i*110),_y:80}));
}

Translate
Community Expert ,
Apr 21, 2014 Apr 21, 2014

use:

var box:Array=[];

for(var i=0;i<6;i++)
{
      box.push( _root.attachMovie("flip_box_lg", "fb"+(i+1), _root.getNextHighestDepth(),{_x:60+(i*110),_y:80}));
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2014 Apr 22, 2014

Thank you so much before, it works perfectly, but how to do onRelease with that movie clip array ?

box.onRelease = function () {

    if(_global.menushow == 0)

          {

                    this.play();

          }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2014 Apr 22, 2014

eh, already done by using

for(var i=0;i<4;i++)

{

          box.onRelease = function () {

                    if(_global.menushow == 0)

                    {

                              this.play();

                    }

is that already right or have another more effiicient one ?

Thanks before

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 22, 2014 Apr 22, 2014

that's correct.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2014 Apr 22, 2014

Thank you very much

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 22, 2014 Apr 22, 2014
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines