Building an array of movie clips

Hi
I have a main document class and an array class (amongst others).
I am not sure how to build the array though. Below is my attempt up to now. But I get the following error code.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at LetterArray/initLetters()
    at LetterArray()
    at BugGoopFSGame() //This is my main document class.
What am I doing wrong?
Thanks
Charine
//in main document class
public var letterArray:LetterArray = new LetterArray(stage);
//in array class
package
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.display.Stage;
    public class LetterArray extends MovieClip
        private var _stage:Stage;
        /*The following are movie clips that need to go into an array so that they can be manipulated togehter.
        Their classes A, F, G, H, I, N, O, S  and T were all dynamically created by flash.*/
//Do I even need these here?
        public var a:A;
        public var f:F;
        public var g:G;
        public var h:H;
        public var i:I;
        public var n:N;
        public var o:O;
        public var s:S;
        public var t:T;
         public function LetterArray(s:Stage)
            _stage = stage;
            initLetters();
        private function initLetters():void
            var LetterArray:Array = new Array[a,f,g,h,i,n,o,s,t];
//rest not relevant

You declare a bunch of objects but you do not instaintiate them.
public var a:A;  // declare but does not yet exist
public var a:A = new A();   // declared and exists

Similar Messages

  • Clearing array in movie clip

    In frame 1 one presses a button and an array ("array 1") of
    11 jpgs load into a movie clip "_root.overview".
    On frame 2 when another button is pressed another array
    ("array2") loads into the same movie clip "_root.overview". The
    only problem is that the second array has one less image than the
    first array and the extra image remains persistent if one toggles
    back.
    Is there a way to clear an array before reloading another in
    the same clip. I tried unloadMovie but that unloads everything. I
    need a way to refresh the array each time it is clicked.
    Thanks

    Clearing out the array isn't going to get you anywhere. You
    need to first
    unload the movies you loaded in. You should be using
    MovieClipLoader class,
    along with its unloadClip method.
    You say you're loading images into an overview clip - how are
    you loading in
    the movies?
    Also, why is clearing out everything (with unloadMovie) bad?
    You load in new
    images anyway right?
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Need help returning correct name from a code created movie clip

    Hello. I am an AS3 n00b with hopefuly a simple question I am designing a simple game in flash. This code creates an array of movie clips and asigns a picture to each one. It is a map screen. What I need is when I click on one of the created movie clips, I need it to return either the index of the clip in the array or the name of the clip. Basicaly anything I can use to tell them apart in the code. Here is the code:
    import flash.display.MovieClip;
    var MapLoader:Array = new Array();
    var strJPGext:String = ".jpg";
    var intContTileNumber:int;
    var strContTilePath:String;
    var intDistStartX:int = 63;
    var intDistStartY:int = 64;
    var intDistMultiplyY:int = 0;
    var intDistMultiplyX:int = 0;
    var intDistCount:int = 0;
    var MapSquare:Array = new Array();
    for (var i:int = 0; i < 729; i++)
             //var MapSquare:MovieClip = new MovieClip();
            MapSquare.push (new MovieClip());
            MapSquare[i].x = intDistStartX + (intDistMultiplyX * 30);
            MapSquare[i].y = intDistStartY + (intDistMultiplyY * 30);
            MapSquare[i].name = "MapSquare" + i ;
            addChild(MapSquare[i]);
            intContTileNumber = i;
            MapLoader.push (new Loader);
            strContTilePath = intContTileNumber + strJPGext;
            MapLoader[i].load(new URLRequest(strContTilePath));
            MapSquare[i].addChild(MapLoader[i]);
            intDistCount++;
            intDistMultiplyX++;
            if (intDistCount > 26){
            intDistCount = 0;
            intDistMultiplyX = 0;
            intDistMultiplyY++;
    stage.addEventListener(MouseEvent.CLICK, reportClick);
    function reportClick(event:MouseEvent):void
        trace("movieClip Instance Name = " + event.target.name);   
    Now all this works fine, it creates the map and assigns the correct picture and places them in the correct X,Y position and it is the correct grid of 27x27 squares. The problem is with the name, when I click on the movie clip, it returns "Instance2" or "Instance5" or whatever. It starts with 2 and then increases each number by 3 for each clip, so the first one is 2, then 5 then 8 and so on. This is no good. I need it to return the name that I assigned it
    . If I put the code in trace(MapSquare[1]) it will return the name "MapSquare1" so I know the name was assigned, but it isnt returning.
    Please assist
    Thanks,
    -red

    Thanks for the resopnse,
    I know I dont really need the name, I just need the index number of the array, but I cant figure out how to get the index name without specificaly coding for it. That is why in the listener event I use event.target.name because I dont know what movie clip is being clicked until it has been clicked on. Basically when a movie clip is clicked it needs to return which index of the array was clicked.
    I could do it this way:
    MapSquare[0].addEventListener(
      MouseEvent.MOUSE_UP,
      function(evt:MouseEvent):void {
        trace("I've been clicked!");
    MapSquare[1].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    MapSquare[2].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    ... ect
    but that is unreasonable and it kind of defeats the purpose of having the array in the first place. The code that each movie clip executes is the same, eventualy that index will be passed into a database and the data at that primary key will be retrieved and returned to the program. So I just need to know, when one of those buttons is clicked, which one was clicked and what is its index in the array.
    I am a VB programer and in VB this is very easy, the control array automatically sends its own index into the function when one of the buttons is clicked. It seems simple enough, I just dont know how to do it in action script.
    Thanks again,
    -red

  • Movie clip not visible

    I the code below I want to add the following array of movie clips: activeLevelofTilesArray
    After I added the code below the swf plays with the following error:
    ReferenceError: Error #1069: Property [object S],[object T],...etc.
    not found on builtin.as$0.MethodClosure and there is no default value.
        at WordArray/startTileTimer()
        at WordArray/activeLevelofTiles()
        at WordArray/tileGenerator()
        at WordArray/levelGenerator()
        at WordArray()
        at wordText/initWordText()
        at flash.display::DisplayObjectContainer/addChild()
        at BugGoopFSGame/startTimer()
    I can also not see the movie clips.
    To try to trouble shoot this I ran a trace statement successfully and I turned off any graphics that might be in front of it. Why can't I see my movieclips and how do I fix error 1069?
    package
        import flash.display.*;
        import flash.text.TextField;
        import flash.events.Event;   
        import flash.utils.Timer;
        import flash.events.*;
        import flash.events.MouseEvent;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        public  dynamic class WordArray extends MovieClip
                    public var wordtext:wordText =  new wordText;
                    var activeWordArray:Array;
                    var activeLevelofTenWordsArray:Array;
                   var activeLevelofTilesArray:Array;
                    public var letterArray:LetterArray;
                    var tileTimer = new Timer(500,384);
            //Movie clips of letter tiles to be used
            public var a:A = new A();
            public var f:F = new F();
            public var g:G = new G(); //etc. for all mc's
            private var wordArray:WordArray;
            private var letterTiles:Array = [a,f,g..etc];
                                  private var  lettersL01:Array = [a,a,f,f,f,g,g,h,h,i,i,n,n,n,o,o,o,o,s,s,t,t,t];
                                  private var  lettersL02:Array = [th,th,  //etc for all levels..
                                public var letterLevels:Array = [lettersL01,lettersL02,lettersL03,lettersL04,lettersL05,lettersL06,lettersL07,lettersL08, lettersL09,lettersL10,
                                                                                 lettersL11,lettersL12,lettersL13,lettersL14,lettersL15,lettersL16,lettersL17,lettersL18,l ettersL19,lettersL20,
                                                                                 lettersL21,lettersL22,lettersL23,lettersL24,lettersL25,lettersL26,lettersL27,lettersL28,l ettersL29,lettersL30];
    public var  wordsL1W1:Array = ["a"];  //etc for all words
    public var  wordsL01:Array = [wordsL1W1,...etc for all levels];
    public var wordLevels:Array = [wordsL01,wordsL02,...etc. for entire word array]
                    private var tf:TextField;
                    // ***constructor code
                    public function WordArray(_tf:TextField)
                        tf = _tf;
                        levelGenerator();
                    function levelGenerator():void
                        //**To get next level of 10 words
                        if(wordLevels.length>0)
                            activeLevelofTenWords();
                            tileGenerator();
                        else
                        //Game is complete
                    function activeLevelofTenWords():void
                        // na
                    function tileGenerator():void
                        if(letterLevels.length>0)
                                activeLevelofTiles();
                        else
                                //Game is complete
                        function activeLevelofTiles():void
                            activeLevelofTilesArray = letterLevels.shift();
                            shuffleTiles(activeLevelofTilesArray);
                            startTileTimer();
                        function shuffleTiles(a:Array)
                            //works perfectly
                        function startTileTimer():void
                                tileTimer.start();
                               trace(activeLevelofTilesArray);  // show in output pannel without errors
                                activeLevelofTilesArray.x = 399;
                                activeLevelofTilesArray.y= 30;
                                addChild[activeLevelofTilesArray];    //can not see these in swf ***these show in output pannel with an error code ReferenceError: Error #1069: Property [object F],[object O],[object F],...etc
                                trace("Letters should run"); //this shows in output pannel
    //rest not applicable..

    Hi Ned,
    Thanks, I moved the shuffle function out of activeLevelofTiles like you said and it still works. Yippeeeee
    I have 3 more issues that I need to sort out:
    I'm not doing this whole tile business correctly. As you predicted - If I trace the tile_index value I see only one tile eg. [object a]. It gives me a different one every time so I know the suffle function still works. I need for it to shuffle through the entire active level *3 so that "the tiles fall from the sky" individually generated by the timer that I have built. I guess I have to add it to an event handler.
    Although the trace (activeLevelofTilesArray[tile_index]); worked, I still can not see even the one object generated in the swf file - I think this will solve itself when issue 3 is solved
    After I descovered issues 1 and 2 above, I attempted to declare the tile_index variable outside of the loop. I must have done it wrong or incompletely because I get the following error messages on all the lines I used tile_index:
                             1120: Access of undefined property tile_index.
    Below is the code now:
    function tileIndex():void   //this must be wrong because it gives me that error code and as you predicted only gives one value (I want te whole lot times 3)
                                    for (var i: Number  =0; i < activeLevelofTilesArray.length*3; i++)
                                var tile_index = (i%activeLevelofTilesArray.length);
                        function activeLevelofTiles():void
                            activeLevelofTilesArray = letterLevels.shift();
                            shuffleTiles(activeLevelofTilesArray);
                                tileTimer.start();
                                trace(activeLevelofTilesArray);
                                activeLevelofTilesArray[tile_index].x = 399;
                                activeLevelofTilesArray[tile_index].y= 30;
                                addChild (activeLevelofTilesArray[tile_index]);  //maybe the addChild will work (issue 2) when the tile_index problem is solved
                                trace("Letters should run");
                                trace (activeLevelofTilesArray[tile_index]);

  • Accessing an Array in a duplicated movie clip

    I have a movie clip that has a script declaration of:
    var myCGroup:Array = Array();
    in the first frame.
    (I've also tried var myCGroup:Array; var myCGroup:Array = new
    Array(); and var myCGroup:Array = []; )
    I duplicate this movie clip multiple times. I'm having
    trouble targeting the variable myCGroup from elsewhere in the
    timeline. Other non-array variables that are declared in the same
    place are fully accessible.
    The only code I've been able to write that writes to this
    variable is:
    eval(targetThumb).myCGroup = prodFlush[2].childNodes;
    which actually takes the childnodes and creates an array with
    them.
    However, reading them back out from a separate function later
    is impossible:
    trace("colors to target =====" +
    eval(masterProds[sm]).myCGroup);
    returns nothing. I can read and write to other variables from
    the same function using the same targeting.
    (yes, materProds[sm] == targetThumb)
    Also, the following code results in an undefined array:
    // for(cg=0;cg<cGroupArray.length;cg++){
    eval(targetThumb).myCGroup.push(cGroupArray[cg].firstChild.nodeValue);
    // trace("time: " + cg + " || adding this color group " +
    cGroupArray[cg].firstChild.nodeValue + " to product: "+ targetThumb
    + "===== " + eval(targetThumb).myCGroup)
    Is this a bug, or a documented local vs. global variable
    option that I'm unaware about regarding arrays?
    Any other thoughts? I'm at my wits end.
    Thanks in advance.
    -r

    question[i] =  questionSet.getString(i);Try:
    question[i] =  questionSet.getString(1);Or better still:
    question[i] =  questionSet.getString("QUESTION");or "ANSWER" for the anser record set.
    ResultSet.getString(int) looks up the value in a column (starting at index 1) in a result set.
    getString(String) looks up the value in a column by column name.

  • How to build a custom movie clip that will be used as a cell renderer for column in a grid ?

    i want to build a datagrid that shows a picture and underneath it a name.
    the problem is i dont want to see all of the pictures, but all the pictures that have certain requirements, so i cant just make one movie clip that includes all the pictures and names.
    so my question is how do i build a movie clip that contains photo and text?.

    You do not create movieclips on the timeline using code, though you can create them and add them as children of something that has been manually placed in the timeline.
    To create a MovieClip using code you use: 
        var mc:MovieClip = new MovieClip();
    If you need to add an image, then however you intend to acquire the image, after it has been acquired, you add it to the MovieClip using:  
        mc.addChild(img); 
    where img is the instance of whatever form of object the image takes (Bitmap, Loader)
    If you need to add a TextField to the MovieClip then you use: 
        var tf:TextField = new TextField();
        mc.addChild(tf);
    and you can set up properties for the textfield such as the font and color and position as well after it has been instantiated (the first line).

  • Removing movie clips in arrays

    Hi there
    I have this code in my Flash file:
    for(bubble in bubbleArray){
         bubbleArray[bubble]._y -= 3;
         if(bubbleArray[bubble]._y < 370){
              bubbleArray[bubble].removeMovieClip();
    I'm wondering, when I remove the movie clips should I also be popping them from the array?
    I have an onEnterFrame function that attaches the movie clips and pushes them into the array, so I'm worried that if I don't pop them the array will continue to increase in size and slow down the movie. Is this the case, or will they be automatically removed from the array by the removeMovieClip() method above?

    Looks like I spoke too soon. I imagined that removing them from the array would be easy, but I'm struggling.
    The movie clip that is removed from its parent clip and should be removed from the array will not always be the first element in the array, and I'll need to remove multiple clips at a time. I've put in a trace action to trace the length of my array, and after about ten seconds it contains about 2500 elements, most of which have already been removed using the removeMovieClip() method. I'm worried this will slow down the movie.
    So to clarify: How can I remove these elements from my array when I remove them from the stage?
    I tried to include something like:
    while(bubbleArray[0] == undefined){
         bubbleArray.shift();
    but it caused Flash Player to freeze up. Also, if I trace bubbleArray[0] it is only "undefined" before something is pushed into the array. Once the clip has been removed from the stage, the trace just returns a blank line, not "undefined".
    I'd appreciate any help.
    Here is all my code:
    stop();
    splash.stop();
    var i:Number;
    var j:Number = 0;
    var minBubbles:Number = 10;
    var maxBubbles:Number = 20;
    var bottomBubbleLimit:Number = 0;
    var topBubbleLimit:Number = 1;
    var bubbleNumber:Number;
    var bubbleX:Number;
    var bubbleY:Number;
    var bubbleScale:Number;
    var bubbleMinScale:Number = 30;
    var bubbleMaxScale:Number = 100;
    var fewerBubbles:Number;
    var ring:String;
    var ringArray:Array = [ringAnimation.ring1, ringAnimation.ring2];
    var bubbleArray:Array = [];
    ringAnimation.onEnterFrame = function(){
        for(ring in ringArray){
            if(ringArray[ring]._y > 370){
                bubbleNumber = (minBubbles + (Math.random() * (maxBubbles - minBubbles)));
                for(i = 0; i < bubbleNumber; i++){
                    bubbleX = ((ringArray[ring]._x - (ringArray[ring]._width / 2)) + (Math.random() * ringArray[ring]._width));
                    bubbleY = ((ringArray[ring]._y - (ringArray[ring]._height / 2)) + (Math.random() * ringArray[ring]._height));
                    bubbleScale = bubbleMinScale + (Math.random() * (bubbleMaxScale - bubbleMinScale));
                    ringAnimation.attachMovie("bubble", "bubble" + String(j), this.getNextHighestDepth(), {_x:bubbleX, _y:bubbleY, _xscale:bubbleScale, _yscale:bubbleScale});
                    bubbleArray.push(ringAnimation["bubble" + String(j)]);
                    j++;
        for(bubble in bubbleArray){
            bubbleArray[bubble]._y -= 3;
            if(bubbleArray[bubble]._y < 370){
                bubbleArray[bubble].removeMovieClip();
        trace(bubbleArray.length);
        if(ringAnimation._currentFrame == 6){
            splash.gotoAndPlay(1);
        }else if(ringAnimation._currentFrame == 12){
            splash.gotoAndPlay(1);
    fewerBubbles = setInterval(reduceBubbles, 600);
    function reduceBubbles(){
        if(minBubbles > bottomBubbleLimit){
            minBubbles--;
        if(maxBubbles > topBubbleLimit){
            maxBubbles--;
        if(minBubbles == bottomBubbleLimit && maxBubbles == topBubbleLimit){
            clearInterval(fewerBubbles);

  • OOP and movie clips in arrays

    I have a number of movieclips in a game that needs to all appear at a certain x;y co-ordinate at the same alpha value and move at a dynamically produced path and basically have the same behaviour up to a point. Flash has created links to .as files for eachEach movie clip.
    I want to put them all in an array to code once. My question - Must this array be in the main class .as file or can I have a seperate .as file written especially for this array.
    Thanks
    Charine
    Facebook: buggoop

    you can pass a reference from your main class to your array class. eg,
    // in document class
    var arrayClass:ArrayClass=new ArrayClass(stage);
    // ArrayClass
    package{
    public class ArrayClass{
    private var _stage:Stage;
    public function ArrayClass(s:Stage){
    _stage=stage;
    dowhatever();
    private function dowhatever():void{

  • Using an array to assign movie clips to buttons

    Thanks in advance for any help you can give me!!
    I've got 5 movie clip buttons.  When a user rolls over a button, I want one movie clip to play. When a user clicks on that button, an alternate movie clip plays. I'm trying to use an array to assign certain movie clips to certain buttons and actions, but I'm not doing something quite right. I can get one button to work correctly, but then am having issues getting the other buttons to work.
    Here is the code I have:
    var currentPage:MovieClip;
    var currentScreen:MovieClip;
    var prevPage:MovieClip;
    var currentButton:MovieClip;
    var arrNavigation:Array = [{button:m1_mcButton, page:m1_mc, screen:s1_mc},
       {button:m2_mcButton, page:m2_mc, screen:s2_mc}]
    for(var i=0;i<arrNavigation.length;i++){
    arrNavigation[i].button.buttonMode=true;
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
    arrNavigation[i].button.addEventListener(MouseEvent.CLICK, onButtonClick);
    function onButtonOver(e:MouseEvent):void
    for(i=0;i<arrNavigation.length;i++) {
    if(arrNavigation[i].button == e.currentTarget)
    currentPage = arrNavigation[i].page;
    currentPage.gotoAndStop("over");
    function onButtonOut(e:MouseEvent):void{
    currentPage.gotoAndStop("out");
    function onButtonClick(e:MouseEvent):void{
    for(i=0;i<arrNavigation.length;i++) {
    if(arrNavigation[i].button == e.currentTarget)
    currentScreen = arrNavigation[i].screen;
    arrNavigation[i].screen.gotoAndPlay("over");

    if your buttons are movieclips, use:
    var currentPage:MovieClip;
    var currentScreen:MovieClip;
    var prevPage:MovieClip;
    var currentButton:MovieClip;
    var arrNavigation:Array = [{button:m1_mcButton, page:m1_mc, screen:s1_mc},
       {button:m2_mcButton, page:m2_mc, screen:s2_mc}]
    for(var i=0;i<arrNavigation.length;i++){
    arrNavigation[i].button.buttonMode=true;
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
    arrNavigation[i].button.addEventListener(MouseEvent.CLICK, onButtonClick);
    arrNavigation[i].button.ivar=i;
    function onButtonOver(e:MouseEvent):void
    currentPage = arrNavigation[e.currentTarget.ivar].page;
    currentPage.gotoAndStop("over");
    function onButtonOut(e:MouseEvent):void{
    currentPage.gotoAndStop("out");
    function onButtonClick(e:MouseEvent):void{
    currentScreen = arrNavigation[e.currentTarget.ivar].screen;
    currentScreen.gotoAndPlay("over");

  • Selecting a random movie clip from array

    I know this should be easy, but I can't seem to make it work. All I want is for the variable currentPage to select randomly from an array so that every time the page loads, it displays a different currentPage.
    This is what I have so far:
    var myImages:Array = new Array("outsource_mc","solutions_mc","staff_mc");
    var randomImages:Array = [];
    var randomCount:Number = 1;
    var r:Number;
    for (var i = 0; i<randomCount; i++) {
    r = Math.floor(Math.random()*myImages.length);
    randomImages[randomImages.length] = myImages.splice(r, 1);
    trace(randomImages);
    currentPage = the random movie clip;
    Thank-you for any help!!

    Anytime you want to see what something is, use the trace() function... it is an essential code design tool that outputs whatever you ask it to in the Output window....  trace(currentPage);
    For the code I showed currentPage would have been one of the instance name String values from the array.  If you had taken the quotes off of the names in the array, it would be a reference to the actual instance.
    As far as the new code you show, I don't know what you are trying to do, nor what it is not doing that you expect it to, but the last two lines have no relationship to the lines preceding it.

  • Help - Using Cue Points to Play Movie Clips

    I have a FLV, into which I have placed about 8 cue points. I
    want a movie clip to play - (each movie clip is simply a snippet of
    supporting text for the video) - when a cue point is "hit". I am
    really quite baffled by most of the documentation that I have read
    so far.
    How can I do this? Many, many thanks for any support you can
    give.
    tommy53

    You can build out a menu by reading the cuePoints array in
    the NetStream.onMetadata handler, or by using the MetadataEvent
    with the FLVPlayback component (AS3). The simple thing for me to
    say is to refer to Chapter 9 of my new Flash Video book. :) (see
    link in my signature below.)

  • Using cue points to acrivate movie clips

    I'm trying to write a simple piece of ActionScript that I can
    adapt and re-use easily. (I'm not very good at programming and I've
    been finding the "help" information very confusing.) I've devised
    quite an elegant solution, if only I could get it to work!.
    I'm using a single frame loop with an onEnterFrame
    construction that deletes itself when the flv has finished playing.
    I've set up a movie clip with various start points for animations
    to be activated at cue points. I'm testing for the cue points in
    the same frame, storing previous cue point names so that each cue
    point triggers the corresponding animation once only. I know the
    main logic works because I've tested it with trace statements to
    prove that the cue points are actually being reached. The problem
    is that the goToAndPlay instructions don't seem to activate the
    movie clip as intended.
    My best guess is that the stop action on the self-looping
    frame is also stopping the movie clip as soon as it starts. Even if
    that is true, I don't know how to solve the problem. And I'm sure
    one of you much more clever people will know better. Here's the
    code. Any suggestions?

    You can build out a menu by reading the cuePoints array in
    the NetStream.onMetadata handler, or by using the MetadataEvent
    with the FLVPlayback component (AS3). The simple thing for me to
    say is to refer to Chapter 9 of my new Flash Video book. :) (see
    link in my signature below.)

  • Movie clip resize not working when image is loaded

    Hello,
    I'm having some strange luck in building an image slide
    show. I load the image paths into an array from an XML
    page and then step through the array elements w/ forward and
    back buttons.
    I have an empty image clip on the stage where I create an
    empty movie clip inside each time a new image is loaded. I load the
    image into the second movie clip like this:
    [code]
    _root.picsPage_mc.mc_pic_loader.mc_individual_pic_loader.unloadMovie();
    _root.picsPage_mc.mc_pic_loader.createEmptyMovieClip(
    'mc_individual_pic_loader', 1 );
    _root.load_movie_and_stop(
    _root.picsPage_mc.mc_pic_loader.mc_individual_pic_loader,
    _root.photo_array[_root.photo_index].image,
    _root.picsPage_mc.mc_pbar, 'regular_load');
    [/code]
    The load_movie_and_stop function is as follows:
    [code]
    function load_movie_and_stop( target_mc:MovieClip,
    movie_clip_to_load:String, p_bar:MovieClip, action:String )
    mc_loader._width = 0;
    mc_slider_bar.mc_drag_pan._x = 0;
    if( action != 'simple_load' )
    p_bar._visible = true;
    p_bar.bar._width = 0;
    var mclListener:Object = new Object();
    mclListener.onLoadStart = function( target_mc )
    if( action != 'simple_load' && action !=
    'regular_load' ){ target_mc.stop(); }
    if( action == 'load_and_play' ){ target_mc.play(); }
    mclListener.onLoadInit = function( target_mc )
    _root.resize_movie_clip(target_mc, 160, 120, 250, 190);
    if( action == 'load_and_stop' ){ target_mc.stop(); }
    mclListener.onLoadProgress = function( target_mc )
    if( action != 'simple_load' )
    percentLoaded = Math.floor( (
    target_mc.getBytesLoaded()/target_mc.getBytesTotal() )*100);
    p_bar.bar._xscale = percentLoaded;
    p_bar.txt_percent = percentLoaded + "% loaded.";
    mclListener.onLoadComplete = function( target_mc ){
    p_bar._visible = false; }
    var my_mcl:MovieClipLoader = new MovieClipLoader();
    my_mcl.addListener(mclListener);
    my_mcl.loadClip( movie_clip_to_load, target_mc );
    }//___endFunc___
    [/code]
    After the image is loaded into the movie clip, I then resize
    the image to be a specific width.
    The image resizing is done w/ this function:
    [code]
    function resize_movie_clip(clip_loader_name:MovieClip,
    max_width:Number, max_height:Number )
    orig_width = clip_loader_name._width;
    orig_height = clip_loader_name._height;
    aspect_ratio = orig_width / orig_height;
    if( (orig_width > max_width) || ( orig_height >
    max_height ) ) // If either dimension is too big...
    if( orig_width > orig_height ) // For wide images...
    new_width = max_height;
    new_height = new_width / aspect_ratio;
    else if( orig_width < orig_height )
    new_height = max_height;
    new_width = new_height * aspect_ratio;
    else if( orig_width == test_height )
    new_width = max_width;
    new_height = max_width;
    else { trace( "Error reading image size."); return false; }
    else { new_width = orig_width; new_height = orig_height; }
    clip_loader_name._width = Math.round(new_width);
    clip_loader_name._height = Math.round(new_height);
    [/code]
    Now, 98% of the time this works perfectly, but there is some
    certain times where the image resizing is completely ignored and
    the image gets loaded as it's normal size.
    Can anyone see why the image sizing get's ignored in some
    instance?
    Thanks for any help,
    Clem

    Found the solution that worked (used ._xscale and ._yscale
    instead of ._width and ._height
    [code]
    function resize_movie_clip(clip_loader_name:MovieClip,
    max_width:Number, max_height:Number, center_offset:Number )
    if( (clip_loader_name._width > max_width) || (
    clip_loader_name._height > max_height ) ) // If either dimension
    is too big...
    if( clip_loader_name._width > max_width )
    _root.picsPage_mc.txt_test = "func if 1";
    clip_loader_name._width = max_width;
    clip_loader_name._yscale = clip_loader_name._xscale;
    if( clip_loader_name._height > max_height )
    _root.picsPage_mc.txt_test = "func if 2";
    clip_loader_name._height = max_height;
    clip_loader_name._xscale = clip_loader_name._yscale;
    else { new_width = orig_width; new_height = orig_height; }
    [/code]

  • Transform on movie clips

    I am loading a bunch of movie clips dynamically. Right now,
    the movie clips undergo a color transform for the onRelease()
    action. Now, I want to be able to transform a group of movie clips
    on the onRelease() action of a single movieclip.
    What would be the recommendation to accomplish this task? I'm
    sure there are many ways to do it, but I don't know where to start.
    I tried to put the movie clips into an array to then access the
    movie clips. I can get the properties of the movieclips that I want
    to transform, but I cannot transform them.

    This is the code that I use:
    for (var j:Number = 0; j<quad.length; j++) {
    var bu_mc:MovieClip = quad[j];
    bu_mc.select();
    trace("xPos: "+bu_mc._x+" building: "+bu_mc._name);
    The correct _x and _name are displayed, but nothing happens
    to the movieclip.
    select() is a function that I've defined. It works when
    called by the movieclip itself, but is not working when called by a
    different movieclip.

  • Movie clip stops playing for no reason

    I am making a banner that has multiple movie clips sharing the same area, creating different rainbow effects when different areas (invisible buttons) are moused over.
    First of all I couldn't figure out if there was a way to have one invisible button over the whole area that changed to a different colored effect with each mouse over (first mouse over the black and whites would change to reds, second would change it to blues, third would change it to browns, etc.). Since I couldn't figure this out I settled on creating three buttons covering a third of the banner each, so when the mouse passes over one button it changes to reds, over another button it changes to blues, over the third it changes to browns.
    The effects are movie clips where each frame has another stripe changing color so it goes in a wave effect from one to the next, and then goes back to white and black in the same manner.  The first frame of each movie clip I had to turn into a nested movie clip so I could turn the alpha to 0, since I was going to have these color effect movie clips on top of one another in the main timeline on different layers, and so you could see the effect even if that color layer wasn't on top. I used the same nested movie clip with zero alpha for the first frame of each color effect clip (reds movie clip, blues movie clip, etc), so I dont' know if that's an issue.
    Anyway, it seemed to work fine for a while, but after working on it for a while longer (and not getting any further since I removed most of the changes I made), now when I test the movie the mouse over does not seem to work correctly. It works fine, seemingly, for the first time I mouse over each button, but in order to have it work again I have to mouse over the button twice, and then it will pause randomly during a part of the clip and I have to move my mouse back over for the movie clip to continue.
    I can't tell if this is because of the overlapping movie clips, or because my buttons are messed up, or if my actionscript is messed up, or if the timeline has to be longer, or what. Currently the timeline is 55 frames, the same as each movie clip.
    I put a movieclip_instance.stop(); command in the first frame of the main timeline, is there a better way to do this? Should I put the stop command in the movie clip itself?
    Here is a section of my AS in the main timeline, this is my first time programming ever, in any language, and trying to learn from the internet is more difficult than I thought it would be.
    redmovie.stop();
    red_btn.addEventListener(MouseEvent.ROLL_OVER, playRed);
    function playRed(event:MouseEvent):void
              redmovie.play();

    I am not sure of what the problem is, so I don't know if this will help or not.  One thing I might suggest is that you use gotoAndPlay(1) instead of play().  That way, if your movieclip is in the middle of playing it won't continue but will start from the beginning.
    You could use one button to have the different movieclips play in sequence if you prefer that.  You would just need to have some form of counter that keeps track of which is the next to play. Somethin like...
    var mcCounter:uint = 0; // start at 0 since an array is being used to identify which movieclip to play
    var mcs:Array = new Array(redmovie, bluemovie, brownmovie);
    only_btn.addEventListener(MouseEvent.ROLL_OVER, playMC);
    function playMC(event:MouseEvent):void
             mcs[mcCounter].play();                  // tell the current mc to play
             mcCounter += 1;                            // increment for the next mc
             if(mcCounter == 3) mcCounter = 0;  // reset the counter if it exceeds the array

Maybe you are looking for

  • Why am I getting Emails from Apple in turkish to an Email-address that isn't used for my Apple ID anymore ?

    Hi everybody, I already apologize if this isn't the right community for my problem.This whole thing is very confusing  so I really hope someone can help me I used Gmail as my official email account and it was also the Email address for my Apple-ID (f

  • Logical dataguard problem

    Hi all, I have prepared a logical dataguard on two local systems. My oracle version is 9i and linux version is Entreprise Linux 3.0. Today when i tried to execute spcreate.sql on the primary database it had thrown some errors in my secondary database

  • DVD Studio Pro 4 crashes every time I try to import

    Everything has been working smoothly for many, many video projects until last night: -finish the edit in FCP7 -send to Compressor -convert to .ac3 audio and .m2v video files in Best DVD 90 min option -open DVDSP4 project -import ,m2v video file as as

  • What is SAP's strategy for XSI (Express Shipping Interface)?

    We are investigating if we can use SAP XSI for parcel tracking with DHL. We like the idea of having an integrated tracking solution that we can call from SO, PO, delivery note and shipment. However, I found information on the internet related to XSI

  • Bridge CS6, preference pane black out

    The preferences window in Bridge is mostly blacked out, I have tried un-installing and then re-installing it from my account in the Cloud but it's still the same. I have tried making the main work area etc as white as possible but it doesn't change t