In to multiple movieclips

_root.page_mc1.lgpd_mc.loadMovie(a[6]);
How do I load the same image in to 6 movieclips?

this is what I've done so far. but it's only showing in lgpd_mc. the remaining MC instances are lgpd_1, lgpd_2...
      _root.page_mc1.lgpd_mc.loadMovie(a[6]);
   for (i=1;i<8;i++){
    duplicateMovieClip("_root.page_mc1.lgpd_mc", "_root.page_mc"+i, i+".lgpd_"+i, i);

Similar Messages

  • Scroll Bar Controlling multiple movieclips?

    Instead of a scroll bar just controlling one movieclip..How could we get it to control multiple movieclips?
    public class MainScroll extends Sprite
              //private var mc_content:Sprite;
              private var content_mc:MovieClip;
              private var content2_mc:MovieClip;
              private var _scrollBar:FullScreenScrollBar;
              //============================================================================================================================
              public function MainScroll()
              //============================================================================================================================
                   addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
              //============================================================================================================================
              private function init():void
              //============================================================================================================================
                   SWFWheel.initialize(stage);
                   //_copy = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque quam leo semper non sollicitudin in eleifend sit amet diam. "; 
                   content_mc = new mc_content();
                   content2_mc = new mc_content2();
                   content_mc.x = 110;
                   content_mc.y = 29;
                   content2_mc.x = 10
                   content2_mc.y = 29
                   addChild(content_mc);
                   addChild(content2_mc);
                   // Scrollbar code 
                   // Arguments: Content to scroll, track color, grabber color, grabber press color, grip color, track thickness, grabber thickness, ease amount, whether grabber is "shiny"
                   _scrollBar = new FullScreenScrollBar(content_mc, 0x000000, 0x408740, 0x73C35B, 0xffffff, 15, 15, 4, true);
                   addChild(_scrollBar);
              //============================================================================================================================
              private function onAddedToStage(e:Event):void
              //============================================================================================================================
                   init();
                   removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

    Ok,
    Here is that code:
         import flash.display.*
         import flash.events.*;
         import flash.geom.Rectangle;
         import gs.OverwriteManager;
         import gs.TweenFilterLite;
         public class FullScreenScrollBar extends Sprite
              private var _content:DisplayObjectContainer;
              private var _trackColor:uint;
              private var _grabberColor:uint;
              private var _grabberPressColor:uint;
              private var _gripColor:uint;
              private var _trackThickness:int;
              private var _grabberThickness:int;
              private var _easeAmount:int;
              private var _hasShine:Boolean;
              private var _track:Sprite;
              private var _grabber:Sprite;
              private var _grabberGrip:Sprite;
              private var _grabberArrow1:Sprite;
              private var _grabberArrow2:Sprite;
              private var _tH:Number; // Track height
              private var _cH:Number; // Content height
              private var _scrollValue:Number;
              private var _defaultPosition:Number;
              private var _stageW:Number;
              private var _stageH:Number;
              private var _pressed:Boolean = false;
              //============================================================================================================================
              public function FullScreenScrollBar(c:DisplayObjectContainer, tc:uint, gc:uint, gpc:uint, grip:uint, tt:int, gt:int, ea:int, hs:Boolean)
              //============================================================================================================================
                   _content = c;
                   _trackColor = tc;
                   _grabberColor = gc;
                   _grabberPressColor = gpc;
                   _gripColor = grip;
                   _trackThickness = tt;
                   _grabberThickness = gt;
                   _easeAmount = ea;
                   _hasShine = hs;
                   init();
                   OverwriteManager.init();
              //============================================================================================================================
              private function init():void
              //============================================================================================================================
                   createTrack();
                   createGrabber();
                   createGrips();
                   addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
                   _defaultPosition = Math.round(_content.y);
                   _grabber.y = 0;
              //============================================================================================================================
              public function kill():void
              //============================================================================================================================
                   stage.removeEventListener(Event.RESIZE, onStageResize);
              //============================================================================================================================
              private function stopScroll(e:Event):void
              //============================================================================================================================
                   onUpListener();
              //============================================================================================================================
              private function scrollContent(e:Event):void
              //============================================================================================================================
                   var ty:Number;
                   var dist:Number;
                   var moveAmount:Number;
                   ty = -((_cH - _tH) * (_grabber.y / _scrollValue));
                   dist = ty - _content.y + _defaultPosition;
                   moveAmount = dist / _easeAmount;
                   _content.y += Math.round(moveAmount);
                   if (Math.abs(_content.y - ty - _defaultPosition) < 1.5)
                        _grabber.removeEventListener(Event.ENTER_FRAME, scrollContent);
                        _content.y = Math.round(ty) + _defaultPosition;
                   positionGrips();
              //============================================================================================================================
              public function adjustSize():void
              //============================================================================================================================
                   this.x = _stageW - _trackThickness;
                   _track.height = _stageH;
                   _track.y = 0;
                   _tH = _track.height;
                   _cH = _content.height + _defaultPosition;
                   // Set height of grabber relative to how much content
                   _grabber.getChildByName("bg").height = Math.ceil((_tH / _cH) * _tH);
                   // Set minimum size for grabber
                   if(_grabber.getChildByName("bg").height < 35) _grabber.getChildByName("bg").height = 35;
                   if(_hasShine) _grabber.getChildByName("shine").height = _grabber.getChildByName("bg").height;
                   // If scroller is taller than stage height, set its y position to the very bottom
                   if ((_grabber.y + _grabber.getChildByName("bg").height) > _tH) _grabber.y = _tH - _grabber.getChildByName("bg").height;
                   // If content height is less than stage height, set the scroller y position to 0, otherwise keep it the same
                   _grabber.y = (_cH < _tH) ? 0 : _grabber.y;
                   // If content height is greater than the stage height, show it, otherwise hide it
                   this.visible = (_cH + 8 > _tH);
                   // Distance left to scroll
                   _scrollValue = _tH - _grabber.getChildByName("bg").height;
                   _content.y = Math.round(-((_cH - _tH) * (_grabber.y / _scrollValue)) + _defaultPosition);
                   positionGrips();
                   if(_content.height < stage.stageHeight) { stage.removeEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelListener); } else { stage.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelListener); }
              //============================================================================================================================
              private function positionGrips():void
              //============================================================================================================================
                   _grabberGrip.y = Math.ceil(_grabber.getChildByName("bg").y + (_grabber.getChildByName("bg").height / 2) - (_grabberGrip.height / 2));
                   _grabberArrow1.y = _grabber.getChildByName("bg").y + 8;
                   _grabberArrow2.y = _grabber.getChildByName("bg").height - 8;
              //============================================================================================================================
              // CREATORS
              //============================================================================================================================
              //============================================================================================================================
              private function createTrack():void
              //============================================================================================================================
                   _track = new Sprite();
                   var t:Sprite = new Sprite();
                   t.graphics.beginFill(_trackColor);
                   t.graphics.drawRect(0, 0, _trackThickness, _trackThickness);
                   t.graphics.endFill();
                   _track.addChild(t);
                   addChild(_track);
              //============================================================================================================================
              private function createGrabber():void
              //============================================================================================================================
                   _grabber = new Sprite();
                   var t:Sprite = new Sprite();
                   t.graphics.beginFill(_grabberColor);
                   t.graphics.drawRect(0, 0, _grabberThickness, _grabberThickness);
                   t.graphics.endFill();
                   t.name = "bg";
                   _grabber.addChild(t);
                   if(_hasShine)
                        var shine:Sprite = new Sprite();
                        var sg:Graphics = shine.graphics;
                        sg.beginFill(0xffffff, 0.15);
                        sg.drawRect(0, 0, Math.ceil(_trackThickness/2), _trackThickness);
                        sg.endFill();
                        shine.x = Math.floor(_trackThickness/2);
                        shine.name = "shine";
                        _grabber.addChild(shine);
                   addChild(_grabber);
              //============================================================================================================================
              private function createGrips():void
              //============================================================================================================================
                   _grabberGrip = createGrabberGrip();
                   _grabber.addChild(_grabberGrip);
                   _grabberArrow1 = createPixelArrow();
                   _grabber.addChild(_grabberArrow1);
                   _grabberArrow2 = createPixelArrow();
                   _grabber.addChild(_grabberArrow2);
                   _grabberArrow1.rotation = -90;
                   _grabberArrow1.x = ((_grabberThickness - 7) / 2) + 1;
                   _grabberArrow2.rotation = 90;
                   _grabberArrow2.x = ((_grabberThickness - 7) / 2) + 6;
              //============================================================================================================================
              private function createGrabberGrip():Sprite
              //============================================================================================================================
                   var w:int = 7;
                   var xp:int = (_grabberThickness - w) / 2;
                   var t:Sprite = new Sprite();
                   t.graphics.beginFill(_gripColor, 1);
                   t.graphics.drawRect(xp, 0, w, 1);
                   t.graphics.drawRect(xp, 0 + 2, w, 1);
                   t.graphics.drawRect(xp, 0 + 4, w, 1);
                   t.graphics.drawRect(xp, 0 + 6, w, 1);
                   t.graphics.drawRect(xp, 0 + 8, w, 1);
                   t.graphics.endFill();
                   return t;
              //============================================================================================================================
              private function createPixelArrow():Sprite
              //============================================================================================================================
                   var t:Sprite = new Sprite();               
                   t.graphics.beginFill(_gripColor, 1);
                   t.graphics.drawRect(0, 0, 1, 1);
                   t.graphics.drawRect(1, 1, 1, 1);
                   t.graphics.drawRect(2, 2, 1, 1);
                   t.graphics.drawRect(1, 3, 1, 1);
                   t.graphics.drawRect(0, 4, 1, 1);
                   t.graphics.endFill();
                   return t;
              //============================================================================================================================
              // LISTENERS
              //============================================================================================================================
              //============================================================================================================================
              private function mouseWheelListener(me:MouseEvent):void
              //============================================================================================================================
                   var d:Number = me.delta;
                   if (d > 0)
                        if ((_grabber.y - (d * 4)) >= 0)
                             _grabber.y -= d * 4;
                        else
                             _grabber.y = 0;
                        if (!_grabber.willTrigger(Event.ENTER_FRAME)) _grabber.addEventListener(Event.ENTER_FRAME, scrollContent);
                   else
                        if (((_grabber.y + _grabber.height) + (Math.abs(d) * 4)) <= stage.stageHeight)
                             _grabber.y += Math.abs(d) * 4;
                        else
                             _grabber.y = stage.stageHeight - _grabber.height;
                        if (!_grabber.willTrigger(Event.ENTER_FRAME)) _grabber.addEventListener(Event.ENTER_FRAME, scrollContent);
              //============================================================================================================================
              private function onDownListener(e:MouseEvent):void
              //============================================================================================================================
                   _pressed = true;
                   _grabber.startDrag(false, new Rectangle(0, 0, 0, _stageH - _grabber.getChildByName("bg").height));
                   stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveListener, false, 0, true);
                   TweenFilterLite.to(_grabber.getChildByName("bg"), 0.5, { tint:_grabberPressColor } );
              //============================================================================================================================
              private function onUpListener(e:MouseEvent = null):void
              //============================================================================================================================
                   if (_pressed)
                        _pressed = false;
                        _grabber.stopDrag();
                        stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveListener);
                        TweenFilterLite.to(_grabber.getChildByName("bg"), 0.5, { tint:null } );
              //============================================================================================================================
              private function onMouseMoveListener(e:MouseEvent):void
              //============================================================================================================================
                   e.updateAfterEvent();
                   if (!_grabber.willTrigger(Event.ENTER_FRAME)) _grabber.addEventListener(Event.ENTER_FRAME, scrollContent, false, 0, true);
              //============================================================================================================================
              private function onTrackClick(e:MouseEvent):void
              //============================================================================================================================
                   var p:int;
                   var s:int = 150;
                   p = Math.ceil(e.stageY);
                   if(p < _grabber.y)
                        if(_grabber.y < _grabber.height)
                             TweenFilterLite.to(_grabber, 0.5, {y:0, onComplete:reset, overwrite:1});
                        else
                             TweenFilterLite.to(_grabber, 0.5, {y:"-150", onComplete:reset});
                        if(_grabber.y < 0) _grabber.y = 0;
                   else
                        if((_grabber.y + _grabber.height) > (_stageH - _grabber.height))
                             TweenFilterLite.to(_grabber, 0.5, {y:_stageH - _grabber.height, onComplete:reset, overwrite:1});
                        else
                             TweenFilterLite.to(_grabber, 0.5, {y:"150", onComplete:reset});
                        if(_grabber.y + _grabber.getChildByName("bg").height > _track.height) _grabber.y = stage.stageHeight - _grabber.getChildByName("bg").height;
                   function reset():void
                        if(_grabber.y < 0) _grabber.y = 0;
                        if(_grabber.y + _grabber.getChildByName("bg").height > _track.height) _grabber.y = stage.stageHeight - _grabber.getChildByName("bg").height;
                   _grabber.addEventListener(Event.ENTER_FRAME, scrollContent, false, 0, true);
              //============================================================================================================================
              private function onAddedToStage(e:Event):void
              //============================================================================================================================
                   stage.addEventListener(Event.MOUSE_LEAVE, stopScroll);
                   stage.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelListener);
                   stage.addEventListener(Event.RESIZE, onStageResize, false, 0, true);
                   stage.addEventListener(MouseEvent.MOUSE_UP, onUpListener, false, 0, true);
                   _grabber.addEventListener(MouseEvent.MOUSE_DOWN, onDownListener, false, 0, true);
                   _grabber.buttonMode = true;
                   _track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true);
                   removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
                   _stageW = stage.stageWidth;
                   _stageH = stage.stageHeight;
                   adjustSize();
              //============================================================================================================================
              private function onStageResize(e:Event):void
              //============================================================================================================================
                   _stageW = stage.stageWidth;
                   _stageH = stage.stageHeight;
                   adjustSize();

  • Mask multiple movieclips from single mask

    Hi,
    h have big movieclip 450X350 and there are many small thumbnails i need to mask those from big movieclip, I need to animate those so that i can't put those in a single movieclip, Is it possible to mask multiple movieclips from single movieclip...?

    If you want to mask them using Actionscript then you should be able to place them inside a movieclip/sprite as separate animations/movieclips and then assign the mask to the container.
    You can mask multiple layers under one layer if you use the timeline

  • Multiple movieclips and mutiple event handling.

    Hi All,
    I have multiple movieclips(images sequence), which I want to add mouseevent (click and drag), keyboard event(left and right arrows) and zoom event(mouse wheel).
    I have this function for only one mc(one image sequence).
    Now if I use this function, I am having problem with calling the function from the same frame.
    That is,
    If click another mc from say frame 3, and click on another function, it should continue from frame 3 only, not start from first frame again.
    Please help.
    Thanks in advance.

    I assume that shows the part where you rotete the house view in a 360degree fashion?
    if so, make a global var on your root timeline:
    var rotationframe:int = 1; //in the beginning of the app all the dirffernt images are sitting on frame 1
    you can access this var from anywehere inside any function of your app by calling:
    root.rotationframe
    now in the function that handles the rotation (lets say its your keyboard function) in the end (after you moved the playhead) you make sure to always set
    root.rotationframe  =  garage.currentFrame;
    and in the function that handles the switching between images you write sth. like
    gotoAndStop(root.rotationframe);
    Be aware, you can`t simply use that code without adapting it to your special needs.

  • Play multiple MovieClips videos in sequence

    Hi,
    I've multiple videos stored as MovieClip objects and would like to merge them into a single MovieClip video object in order to play all of them in sequence (so that a user thinks it's a single longer video). Is it possible?
    Thanks a lot!

                   yes very possible.
    there are a few ways to do this, but this is the route i would go.
    if you are good with OOP let me know and i will create the class's for you otherwise, also is there sound involved?
    var index:int=0
    var getTo:int=0
    var currentClipInPlay:MovieClip
    var clipsToPlay[LoaderA,LoaderB,LoaderC,LoaderD]   //assuming these are your loaders of the movieCLips
    function beginPlaying(start:,finish:int){
         var startPlayingMovie:MovieClip=turnInToMc(start)
                            index=start
                             getTo=endValue
                            assumePlay( startPlayingMovie)
    protected function assumePlay(starting:MovieClip){
              if(index<getTo){
                   addChild(starting)
                   resume()
              }else{
                   pause()
    function turnInToMc(index):MovieCLip{
    Loader(clipsToPlay[index]).content as MovieClip
    function pause(){
    mc:MovieCLip= turnInToMc(index).stop()
        removeEventListener(Event.ENTER_FRAME,onFrame)
    currentClipInPlay=null
    function resume(){
    currentClipInPlay=turnInToMc(index)
    if(!hasEventListener(Event.ENTER_FRAME)){
         addEventListener(Event.ENTER_FRAME,onFrame)
    function onFrame(e:Event){
      var tFrames=currentClipInPlay.totalFrames
          if((currentClipInPlay.currentFrames==tFrames){
                   stopAndPlayNext(currentClipInPlay)
         }else{
              currentClipInPlay.nextFrame()
    function stopAndPlayNext(mc:MovieClip){
    pause()  
    index++
    assumePlay(turnInToMc(index))
    removeChild(mc)
    mc.gotoAndStop(0)
    I'll explain when i get to work what this is

  • Multiple MovieClips Loading SWF From Same Array (Posted Code)

    Hey there,
    I'm currently working on a project that has eight separate movieclips (for loading content) on separate layers.  I have placed code in these mc's to randomly draw from the same array of 61 different swf's.  Each mc randomizes the array just fine, but here's the problem.  The code works great for one instance, but as soon as I add the code (including renaming) to the other mc's, the swf won't load/play.  I am not getting an compiler errors, and am kinda stuck as to what the problem may be.  Here's an example of the code I'm using.  It is the same for each mc, except I'm renaming the variables as well as the instances for each mc.  Thanks for any suggestions.
    Mike
    //filename = new Array("screen1.swf","screen2.swf","screen3.swf","screen4.swf","screen5.swf","screen6.swf" ,"screen7.swf","screen8.swf","screen9.swf","screen10.swf","screen11.swf","screen12.swf","s creen13.swf","screen14.swf","screen15.swf","screen16.swf","screen17.swf","screen18.swf","s creen19.swf","screen20.swf","screen21.swf","screen22.swf","screen23.swf","screen24.swf","s creen25.swf","screen26.swf","screen27.swf","screen28.swf","screen29.swf","screen30.swf","s creen31.swf","screen32.swf","screen33.swf","screen34.swf","screen35.swf","screen36.swf","s creen37.swf","screen38.swf","screen39.swf","screen40.swf","screen41.swf","screen42.swf","s creen43.swf","screen44.swf","screen45.swf","screen46.swf","screen47.swf","screen48.swf","s creen49.swf","screen50.swf","screen51.swf","screen52.swf","screen53.swf","screen54.swf","s creen55.swf","screen56.swf","screen57.swf","screen58.swf","screen59.swf","screen60.swf","s creen61.swf");
    //i = filename.length;
    //k=random(i)
    //_root.movieTarget.loadMovie(filename[k]);
    //movieTarget._xscale=80;
    //movieTarget._yscale=80;
    var fileNames:Array = ["screen1.swf","screen2.swf","screen3.swf","screen4.swf","screen5.swf","screen6.swf","scr een7.swf","screen8.swf","screen9.swf","screen10.swf","screen11.swf","screen12.swf","screen 13.swf","screen14.swf","screen15.swf","screen16.swf","screen17.swf","screen18.swf","screen 19.swf","screen20.swf","screen21.swf","screen22.swf","screen23.swf","screen24.swf","screen 25.swf","screen26.swf","screen27.swf","screen28.swf","screen29.swf","screen30.swf","screen 31.swf","screen32.swf","screen33.swf","screen34.swf","screen35.swf","screen36.swf","screen 37.swf","screen38.swf","screen39.swf","screen40.swf","screen41.swf","screen42.swf","screen 43.swf","screen44.swf","screen45.swf","screen46.swf","screen47.swf","screen48.swf","screen 49.swf","screen50.swf","screen51.swf","screen52.swf","screen53.swf","screen54.swf","screen 55.swf","screen56.swf","screen57.swf","screen58.swf","screen59.swf","screen60.swf","screen 61.swf"]
    fileNames.sort(function () {
        return Math.round(Math.random());
    trace("Random array: " + fileNames);
    var currentMovieNum:Number = 0    ;
    this.createEmptyMovieClip("container", _root.getNextHighestDepth());
    var mcl:MovieClipLoader = new MovieClipLoader();
    var mclListener:Object = new Object();
    mcl.addListener(mclListener);
    mclListener.onLoadInit = function(movieTarget:MovieClip) {
        trace("Preparing to play: " + fileNames[currentMovieNum]);
    movieTarget.loadClip(fileNames[currentMovieNum], container);
    movieTarget._xscale=80;
    movieTarget._yscale=80;
    this.onEnterFrame = function() {
        if (currentMovieNum == fileNames.length) {
            currentMovieNum = 0;
        } else {
            if (movieTarget._currentframe == movieTarget._totalframes) {
                mcl.loadClip(fileNames[currentMovieNum], movieTarget);
                currentMovieNum++;

    Thanks for taking a look at this.  The randomizer seems to work just fine, as here is a sample output from the trace:
    Random array: screen47.swf,screen2.swf,screen57.swf,screen21.swf,screen9.swf,screen49.swf,screen36.swf, screen17.swf,screen6.swf,screen59.swf,screen15.swf,screen12.swf,screen33.swf,screen25.swf, screen42.swf,screen22.swf,screen24.swf,screen40.swf,screen11.swf,screen19.swf,screen32.swf ,screen35.swf,screen7.swf,screen39.swf,screen23.swf,screen4.swf,screen1.swf,screen48.swf,s creen31.swf,screen45.swf,screen29.swf,screen18.swf,screen51.swf,screen14.swf,screen34.swf, screen10.swf,screen38.swf,screen26.swf,screen16.swf,screen13.swf,screen55.swf,screen37.swf ,screen44.swf,screen61.swf,screen43.swf,screen20.swf,screen28.swf,screen30.swf,screen56.sw f,screen50.swf,screen54.swf,screen53.swf,screen46.swf,screen58.swf,screen41.swf,screen8.sw f,screen5.swf,screen52.swf,screen3.swf,screen60.swf,screen27.swf
    Might you be able to lead me down a better path?  I'm currently unable to get this to function for multiple symbols.  The previous is the code that I've placed on the first keyframe of a movieclip with an instance name of movieTarget.  Works swimmingly for one, but once the code is placed on the other symbols on different layers, it seems to only work on the lowest layer in the project.
    M

  • Apply bounce to multiple movieclips

    Hello there,
    I'm having a bit of a problem with a basic game I'm making where I want to have a number of animals which bounce around the stage.. I can't seem to get the code to apply to more than one of my movieclips using a loop.. if I try to apply vx and vy to the individual movieclips then nothing happens.. for now I have the ten movieclips on the stage but only one whichbounces around.. I have managed to get all of them to move but they each stay in their own area of the stage, but I'd like each to bounce around the stage and not interfere which the others movement..
    Thanks in advance
            public function Bounce()
                crosshairs = new Target();
                addChild(crosshairs);
                init();
            private function init():void
                stage.scaleMode = StageScaleMode.NO_SCALE;
                stage.align=StageAlign.TOP_LEFT;
                for(var i = 0; i < 10; i++) {
                    horse = new Horse();
                    horse.x = Math.random() * stage.stageWidth;
                    horse.y = Math.random() * stage.stageHeight;
                    addChild(horse);
                    animals.push(horse);
                    horse.addEventListener(MouseEvent.CLICK, onHorseClick);
                vx = Math.random() * 40 - 20;
                vy = 10;
                addEventListener(Event.ENTER_FRAME, onEnterFrame);
            private function onEnterFrame(event:Event):void
                    crosshairs.x = stage.mouseX;
                    crosshairs.y = stage.mouseY;
                    vy += gravity;
                    horse.x += vx;
                    horse.y += vy;
                    var left:Number = 0;
                    var right:Number = stage.stageWidth;
                    var top:Number = 0;
                    var bottom:Number = stage.stageHeight;
                    if(horse.x + horse.width > right)
                        horse.x = right - horse.width;
                        vx *= bounce;
                    else if(horse.x - horse.width < left)
                        horse.x = left + horse.width;
                        vx *= bounce;
                    if(horse.y + horse.height > bottom)
                        horse.y = bottom - horse.height;
                        vy *= bounce;
                    else if(horse.y - horse.height < top)
                        horse.y = top + horse.height;
                        vy *= bounce;
            private function onHorseClick(event:MouseEvent):void {
                var animal = event.currentTarget;
                removeChild(animal);

    I've slightly changed the code and I think I can see a little better now what is happening with multiple item..
    I created a function which I call onEnterFrame, which loops through an array of movieclips and adds the bounce..
    The problem is that when ANY of the movieclips hit ANY of the boundaries, ALL of the movieclips react accordingly instead of just the movieclip which has collided with the side of the stage.
    Here is my updated code, can anyone see an answer to this ?
    private function onEnterFrame(event:Event):void {
         startBounce();
    private function startBounce():void {
         for(var i:uint = 0; i < animals.length; i ++) {
              var animal = animals[i];
              animal.vy += gravity;
              animal.x += vx;
              animal.y += vy;
              if(animal.x + animal.width > right) {
                   animal.x = right - animal.width;
                   vx *= bounce;
              else if(animal.x - animal.width < left) {
                   animal.x = left + animal.width;
                   vx *= bounce;
              if(animal.y + animal.height > bottom) {
                   animal.y = bottom - animal.height;
                   vy *= bounce;
              else if(animal.y - animal.height < top) {
                   animal.y = top + animal.height;
                   vy *= bounce;

  • Multiple movieclips with same export for AS names? Possible?

    Ls,
    Im working on an app for mobile devices.
    Since the demensions of some of them, i.e. phones as opposed to tablets, have a much smaller screen, wanted to use different sets of mc's depending on screen size (device dimension wise, not resolution).
    So a smaller device would use the mc's with larger gfx so they would still be decipherable and the larger devices could use smaller gfx so to be abale to get a larger part on the screen at the same time
    - I could just scale the entire screen clip all the time, but this will slow it down too much i think
    - I could create multiple instances and use different names and then sort them out run time in AS, but this would also steal processor time. Im not really for that.
    - I could publish multiple versions, depending on device its for. But this would require me to maintain multiple sources on upgrades. I can feel the hurt already.
    I was hoping it is possible somehow to export the movieclips as .swf's or something and then sorting out run time wich one to import/use/load.
    Then, hopefully i can refer to them in my code with the same name's but they will be different sizes depending on wich i had chosen to include/load.
    Makes any sense?
    Any info on what's the best way to proceed is highly appreaciated.
    Regards,
    Mac

    Kglad,
    I'm not sure I understand what you mean.
    I meant: if I use as object creation with as like
    mc:movieclip = new someclip();
    It had the dimensions it has in the library.
    If I then do a
    mc.scaleX = mc.scaleY = .75;
    It wil change size yes.
    But wont this require flash to internally resize it each time it has to paste it onto the screen/ into the canvasbitmap?
    Or does it take a snapshot from the Library and use that until te next scale operation?
    The reason i ask is because a: i dont know ****, b: if i resize it really small, then resize it large, it seems unaffected by the first resize to small.
    So i''m thinking it still uses the same mc source, and rescales it from that all the time.
    Wich would afcourse affect performance.
    Highest regards,
    Mac

  • Mask multiple movieclips by single movieclip

    Hi, I have make many thumbnails(t1,t2,t3....) on homepage of my website now i req. to mask all thmbnails by one movieclip(mskMC).
    Thanks for your support.

    I cn't do that because my app structure will be change and many functionalites will be affect from it

  • Mask multiple movieclips from single movieclip

    Hi i am trying to mask 3 thumbnails from 1 movieclips
    mc.samsungchamp.mask=mc.msk
    mc.samsungduos.mask=mc.msk
    mc.samsungace.mask=mc.msk
    but these thumbs are is not showing masked.

    Is this not possible to mask all movieclips through one movieclip, without putting movieclips into single movieclip.??

  • Mask multiple MovieClip

    Hi !
    Is it possible to mask more than one movieclip in action
    script.
    I see that's possible in the gaphical author environment.
    _root.attachMovie("mask_mc","mask_mc",10);
    _root.attachMovie("a_mc","a_mc",0);
    _root.attachMovie("another_mc","another_mc",1);
    _root.a_mc.setMask(_root.mask_mc);
    _root.another_mc.setMask(_root.mask_mc);
    This simple code don't work...
    Thanks a lot.
    Tivins.

    Tivins,
    > Is it possible to mask more than one movieclip in
    > action script. I see that's possible in the gaphical
    > author environment.
    Yes. Make sure to include all the movie clips you want to
    mask inside
    of a single movie clip, then mask that "container" movie
    clip.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Export problems multiple movieclips to image sequence

    For our customer we made several flash animations. My output has to be image sequences for Cinemascope format. The export function in Flash for image sequences does not work! All my images are the same frame. This is frame 0 on the timeline. So the embedded movieclips wont playback.
    When exporting a Quicktime movie, some frames are skipped and missing in the output! So the export options in Flash are totally not working for my situation. We bought an application SWF to image but also here are some frames missing in the export. I can not relay on Flash and this application.
    The project is built like this: we made several movieclips and scaled them and put them in position. Then we made one new movieclip with all the earlier made movieclips inside. Then scaled the entire movieclip to the Cinemascope stage size.
    Are we using Flash in a wrong way here?
    Why does the exports functions don't work on my project? (built in movieclips won't play, quicktime mov skips images)
    How can i solve this problem?
    Thanks in advance,
    Greetings Henk

    Ok this is workaround but should in principle do what you want:
    //create an instance of library object
    var mylibrary = fl.getDocumentDOM().library;
    var doc = fl.getDocumentDOM();
    var tl = fl.getDocumentDOM().getTimeline();
    //get items in library in an Array
    itemArray = mylibrary.items;
    totalCount = itemArray.length;
    for(var i=0;i<totalCount;i++){
        myItem = itemArray[i];
        myItemType = myItem.itemType;
        myItemName = myItem.name;
        mylibrary.editItem(myItemName);
        fcNum = tl.layers[0].frameCount;
        for (f=0; f<fcNum;f++){
                tl.setSelectedFrames(f, f)
                framenum = f + 1;
                //select your destination, on MAC use something like file:///Macintosh HD/Users/username/Desktop/
                doc.exportPNG("file:///C|/test/"+myItemName+ "_" + framenum +".png", true, true);
    1: open the fla file you want to convert to a movie and create a backup
    2: Create a new Flash Javascript file and insert the code above, Make sure you have enough hard disk space in your destination folder
    3: Press the play button and Flash will automatically parse through all items frame by frame in your library and save the images as png
    4: Take a break as it might take a long time

  • Instantiation can be multiple movieclips with a loop?

    I would like to know how I can instantiate multiple objects with a for
    for example my code I created six squares of different colors and have instantiated with the name "cubeA, B, C, D, E, F"
    apart in their xy position attribute I have given a value to each aparesca to me on the stage but in those cordenadas And always add +25 to make aparescan top of each other but can see each one.
    Code 1:
    var Cube1:CubeA = new CubeA();
    Cube1.x = 40
    Cube1.y = 140
    addChild(Cube1)
    var Cube2:CubeB = new CubeB();
    Cube2.x = 65
    Cube2.y = 140
    addChild(Cube2)
    var Cube3:CubeC = new CubeC();
    Cube3.x = 90
    Cube3.y = 140
    addChild(Cube3)
    var Cube4:CubeD = new CubeD();
    Cube4.x = 115
    Cube4.y = 140
    addChild(Cube4)
    var Cube5:CubeE = new CubeE();
    Cube5.x = 140
    Cube5.y = 140
    addChild(Cube5)
    var Cube6:CubeF = new CubeF();
    Cube6.x = 165
    Cube6.y = 140
    addChild(Cube6)
    I want to achieve is to instantiate all objects with a name but for each class must be contained in an array
    something like this:
    var McCubeClassName:Array;
    McCubeClassName = [CubeA,CubeB,CubeC,CubeD,CubeE,CubeF]; // Mcs of Cube
    for (var i = 0; i<=McCubeClassName.length; i++)
      cube[i].x = 40
      cube[i].y = (i * 16) + 10;
      addChild(Cube[i])
    what I want is to do the quotas instantiated one by one but this time using a for to make it faster and write fewer lines of code, because I have to do something simimar for a card game but not 54 letters are 100, they know that it is 100 times declare code 1, I'm going crazy!

    I don't see why you need to start out with the Class names as strings. I use code very similar to Jennifer's regularly.
    Jennifer, have you tried your code? If so, where is it failing?
    Note that if you're going to use getDefinitionbyName(), you need something like this:
    try {
         var cube:BaseCube = new c() as BaseCube;//note that the only thing that should begin with caps are Class names and constants
    } catch (e:Error) {
         trace('The library did not contain a definition for ' + yourClassNameString);
    Otherwise when you get errors it will prevent your swf from running.
    Oh, I see why your iriginal code didn't work now. You need to change
    for (var i = 0; i<=McCubeClassName.length; i++) 
      cube[i].x = 40 
      cube[i].y = (i * 16) + 10; 
      addChild(Cube[i]) 
    to
    //Note I also changed the name of your mcCubeClass variable to reflect best practice and what it does.
    var cube:Array = [];//not sure if this is what you want, but this is how you are using it
    for (var i = 0; i<mcCubeClass.length; i++) 
         var newCube:BaseCube = new mcCubeClass();
         cube.push(newCube);
      cube[i].x = 40 
      cube[i].y = (i * 16) + 10; 
      addChild(cube[i]) 

  • Multiple movieclips, 3 functions with unique targets 

    (cs3,as2)
    I was wondering if there's an easier way of getting these
    functions to work for about 150 different buttons? I just put three
    of the blocks of code in here to show you what it looks like across
    more than one. On the gotoAndStop actions, the name is a frame
    label on a seperate swf file. the name used everywhere else is an
    instance name on a dynamic textbox located inside a movieclip. All
    this script is located in an external .as file. Thanks so much for
    reading.

    the code looks... well... ok - but the line:
    myMc.fade.person.text = "Alicia rose";
    is the problem. this is assigning the same text to all
    instances, you can change this by adding a new propertiy to each
    Object within the Array, something like - mcText:"Alicia Rose",
    (differnet for each object of course) and then use that prop to
    assign the field, similar to the other methods used in there - eg.
    myMc.fade.person.text = this[myArray_array
    .mcText];

  • Remove stage listener for multiple movieclips

    I would like to completely remove personalized stage listeners, for each movieclip as soon as they are placed where they need to be, but the listeners remain every single time a new clip is dragged.
    Thank you for any help!
    function clickToDrag(targetClip:MovieClip):Function {
              return function(e:MouseEvent):void {
                        startingPosition[targetClip.name] = new Point(targetClip.x, targetClip.y);
                        targetClip.startDrag(false, new Rectangle(0,0,800,600));
                        setChildIndex(targetClip,numChildren - 1);
                        trace('clickToDrag function invoked\ntargetClip: ' + targetClip.name + '\startingPosition: ' + startingPosition[targetClip.name] + '\n\n');
                        stage.addEventListener(MouseEvent.MOUSE_UP, releaseToDrop);
    /*          releaseToDrop
              @function          stopDrag for current clip, if dropped off stage, returns to recorded beginning location
              @param                     targetClip:MovieClip
              @param                     startPosition:int
              @returns          event:void
    function releaseToDrop(targetClip:MovieClip):Function {
              return function(e:MouseEvent):void {
                        targetClip.stopDrag();
                        trace('releaseToDrop function invoked\ntargetClip: ' + targetClip.name + '\n\n');
                        stage.removeEventListener(MouseEvent.MOUSE_UP, releaseToDrop);
                        stage.addEventListener(Event.MOUSE_LEAVE, mouseGone);
                        function mouseGone () {
                                  TweenLite.to(targetClip, .2, { x: startingPosition[targetClip.name].x });
                                  TweenLite.to(targetClip, .2, { y: startingPosition[targetClip.name].y });
                                  //toggle comments to ease or not ease back to startingPosition
                                  //targetClip.x = startingPosition[targetClip.name].x;
                                  //targetClip.y = startingPosition[targetClip.name].y;
                                  stage.removeEventListener(Event.MOUSE_LEAVE, mouseGone);
                                  trace('releaseToDrop function invoked\ntargetClip dragged out of bounds: ' + targetClip.name + '\n\n');
    /*          checkTarget
              @function          checks if current clip is dragged to drag1target(dock), updates boat weight and waterline, remove listeners
              @param                     targetClip:MovieClip
              @param                     lbsAmount:int
              @param                     targetLocation:MovieClip
              @returns          event:void
    function checkTarget(targetClip:MovieClip,lbsAmount:int,targetLocation:MovieClip):Function {
              return function(e:MouseEvent):void {
                        if (targetClip.hitTestObject(drag1target)) {
                                  targetClip.x = targetClip.x;
                                  targetClip.y = targetClip.y;
                                  drop.play();
                                  TweenLite.to(targetClip, .5, { alpha: 0, onComplete:fadein });
                                  function fadein() { TweenLite.to(targetLocation, .5, { alpha: 1 }); }
                                  noMC.waterlineMC.y = noMC.waterlineMC.y - 3;
                                  lbs -= lbsAmount;
                                  lbsTxt.htmlText = lbs + "<font size='16'>lbs</font>";
                                  targetClip.buttonMode = false;
                                  targetClip.mouseEnabled = false;
                                  targetClip.removeEventListener(MouseEvent.MOUSE_UP, checkTarget);
                                  targetClip.removeEventListener(MouseEvent.MOUSE_DOWN, clickToDrag);
                                  /* TODO: Issue with stage listener for every clip, opportunity to handle programmatically? */
                                  /* check to see if eventListenter is still present */
                                  if(targetClip.hasEventListener(MouseEvent.MOUSE_DOWN)) {
                                            trace(targetClip.name + ' still has MOUSE_DOWN event listener');
                                  if(targetClip.hasEventListener(MouseEvent.MOUSE_UP)) {
                                            trace(targetClip.name + ' still has MOUSE_UP event listener');
                        } else if (borderMC.hitTestPoint(targetClip.x, targetClip.y, true)){
                                  /*targetClip.y = startingPosition[targetClip.name].y;
                                  targetClip.x = startingPosition[targetClip.name].x;                              */
                                  TweenLite.to(targetClip, .2, { x: startingPosition[targetClip.name].x });
                                  TweenLite.to(targetClip, .2, { y: startingPosition[targetClip.name].y });
                        } else {
                                  /*targetClip.y = startingPosition[targetClip.name].y;
                                  targetClip.x = startingPosition[targetClip.name].x;          */
                                  TweenLite.to(targetClip, .2, { x: startingPosition[targetClip.name].x });
                                  TweenLite.to(targetClip, .2, { y: startingPosition[targetClip.name].y });

    i will try to show you a way that might help you to understand how the event-model in as3 is meant to work.
    look at this code:
    //with a MovieClip "DragClip" in the Library exoported for ActionScript
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    for (var i:int = 0; i<10;i++){
        var mc:DragClip = new DragClip();
        addChild(mc);
        mc.mouseChildren = false;
        mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
        mc.addEventListener(MouseEvent.MOUSE_UP, dragStop);
        addChild(mc);
    function dragStart(e:MouseEvent):void {
        e.currentTarget.startDrag();
        trace("dragging started");
    function dragStop(e:MouseEvent):void {
        e.currentTarget.stopDrag();
        trace("dragging stopped");
        e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, dragStart);
        e.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, dragStop);
    //it places hundred Movieclips on the stage
    //makes them draggable
    //but after they are dragged once
    //they stay in place

Maybe you are looking for

  • File- XI- RFC, JDBC

    Hello Gurus. I have a scenario where i have to load File to JDBC (Oracle) and RFC (SAP) in parallel. If my file is QoS (EO), then do I have to use BPM to send the message to JDBC and RFC, or I can just create two Receivers, and the message will split

  • GR without PO - Movement types?

    Hi All, As per SOX compliance we have to remove all movement types from the system which allow Goods Receipt without PO. Is 561 the only movement type which allows GR without PO or are there any more movement types which I need to remove. Regards, V

  • FPS & GAME ISSUES ON YOSEMITE

    Hi after upgrading my late 2007 imac to Yosemite , i seem to have developed an FPS issue with my games , I've searched around a bit and it seems there are a few people with the same issue. mainly im playing or should i say was .. CS:GO & F12013 , bot

  • Webcast-OBIEE Analytics/Reporting Solutions for E-Business Ste, Sep 9 12EDT

    TODAY: I invite you all to an Oracle BI Applications related Techcast, let's use this for interactive Q&A as well. We can follow up on the question here. See more details at http://OracleBIWA.org Wednesday, September 9, 12 noon Eastern OBIEE Analytic

  • I would like to change my current Itunes ID by my Icloud ID

    I would like to change my current Itunes ID by my Icloud ID