Trying to access a specific movie clip with a string

Ok, what I am trying to do is create as many movie clips as I
need and then access those movie clips using string values. These
string values are stored in an array and coincide with a given
movie clips instance name. Check out the following code:
I think my problem is that Flash is trying to call movie clip
methods on a string instance. I'm not sure how to type cast in
Flash, or even if it is possible, but how would I access the
strings as movie clips?

DuhChamp,
> I think my problem is that Flash is trying to call movie
> clip methods on a string instance.
Bingo.
> I'm not sure how to type cast in Flash, or even if it is
> possible, but how would I access the strings as movie
> clips?
Use eval() or the array access operator, []. Details here
http://www.quip.net/blog/2006/flash/actionscript-20/reference-objects-dynamically
David
stiller (at) quip (dot) net
Dev essays:
http://www.quip.net/blog/
"Luck is the residue of good design."

Similar Messages

  • My desktop IMac OSX 10.6.8 : IMovie '11: Trying to upload a home movie clip from my Panosonic camera model PV-DV203D. I've had this camera several years, and used it with Windows desktop. Now trying to work with my Mac. I have a USB cable, both ends fit,

    My desktop IMac OSX 10.6.8 : IMovie '11: Trying to upload a home movie clip from my Panosonic camera model PV-DV203D. I've had this camera several years, and used it with Windows desktop. Now trying to work with my Mac. I have a USB cable, both ends fit, but iMovie '11 does not recognize it. Is there a driver fix for this?

    What kind of Mac to you have?  This camera is a tape based DV one that connects best with firewire and I cannot tell if your Mac has firewire.  If your mac *does* have firewire, get a camcorder firewire cable and try again.
    ETA:  Oops, I am pretty sure that all the "desktop iMacs" have firewire, so you should be good to go.  You will probably need a cord that goes from FW800 to your camcorder.

  • Problem with accessing dynamically created movie clips, returns null...

    Hopefully this is a stupid question with an easy answer, if my code is straight forward enough.
    I am using this snippet of code to create menu items, and then use the jCount variable below to give the clips an index number, like so (which seems to be working just fine):
    for(var j:Number=0;j<xmlSubMenuLength;j++){ 
        var mcSubMenuItem:mcSubMenu=new mcSubMenu();   
        addChild(mcSubMenuItem);    
        jCount++;   
        mcSubMenuItem.name = "mcSubMenuItem" + jCount;
        //traces out names correctly
        trace ("---------------------------------jCount NAME = "+ mcSubMenuItem.name);
        mcSubMenuItem.x=mcMenuHolder.x+20;
        mcSubMenuItem.y =mcMenuHolder.y;
        mcSubMenuItem.y+= nextBtnY;
        nextBtnY+=subtopicSpace;
        global_subi.text = String(jCount); //i see the proper count of 10 in the text field
    However, when I try to access the clips using this snippet:  
    for(var j:Number=0;j<Number(global_subi.text);j++)//
      trace("GLOBAL SUBI = "+ String(global_subi.text));  //traces out 10, which it should
      var scSubMenuItem:String = "mcSubMenuItem" + j;  
      var scSubContent:Object = this.getChildByName(scSubMenuItem);
      trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scSubContent:Object = "+ scSubContent); //returns null!
    My last trace statement returns null. Can anyone see my error, or explain why I can't access my clips after they have been created?
    Thank you muchly,
    ~Chipleh

    Hi kglad,
    Thanks for the response.
    "it's not clear from the shown code that jCount is initialized." - I've posted the relevant code below, which shows that I'm initializing jCount.
    "and it's not clear why you don't use j instead of jCount in that for-loop" - j is used as loop for creating the subtopic movie clips within the i for-loop. So, for each topic in i for-loop, create a group of suptopics using the j for-loop. The j for-loop re-initiates j every time the length of the subtopics is reached(if that makes any sense) - i.e. topic1>subtopic 1,2,3,4 : topic2>subtopic>1,2 : topic3>subtopic1,2,3,4
    jCount is used to keep a running count of the total number of subtopcs created - i.e. per the example above, jCount will display 10.
    var topicSpace:uint=button_mc.height;
    var subtopicSpace:uint = button_mc.height;
    var nextBtnY:uint = 0;//whatever;
    var jCount:Number = 0;
    function createXMLMenu(menuLength:Number,itemName:XMLList):void{
         var navItemText:XMLList = itemName;
          for(var i:Number=0;i<menuLength;i++)
               var mcMenuItem:mcMenu=new mcMenu();        
               addChild(mcMenuItem); 
               mcMenuItem.btnTxt.htmlText = i+1 +". " +navItemText[i];  
               mcMenuItem.ivar = i;  
               mcMenuItem.name = "mcMenuItem" + i;  
               mcMenuItem.x=mcMenuHolder.x;
               mcMenuItem.y =mcMenuHolder.y;
              //kglad's addition
               mcMenuItem.y+= nextBtnY;
               nextBtnY+=topicSpace; 
               var subVar:Number = i;//mcMenuItem.ivar 
               //Submenu content
               var xmlSubMenuLength:Number = xml.sim.bodyText.page[i].subpage.length()
               var menuItemAttachment:MovieClip = MovieClip(mcMenuItem); 
               for(var j:Number=0;j<xmlSubMenuLength;j++)
                     var xmlSubPageNumber:XMLList = xml.sim.bodyText.page[subVar].subpage;
                     var subNavLinkNumber:Number = xmlSubPageNumber[j];
                     var subTitleText:String = xml.sim.bodyText.page[subVar].subpage.subNavItem[j];
                     var mcSubMenuItem:mcSubMenu=new mcSubMenu();
                     trace("mcSubMenuItem.ivar = "+ j+1);
                     var mc2Attach2:MovieClip = MovieClip(menuItemAttachment);
                     mcSubMenuItem.btnTxt.htmlText = j+1 +". " +subTitleText;   
                     mcSubMenuItem.ivar = Number(subVar);
                     mcSubMenuItem.jvar = Number(j);
                     addChild(mcSubMenuItem);
                     jCount++;   
                     mcSubMenuItem.name = "mcSubMenuItem" + jCount;
                     trace ("---------------------------------jCount NAME = "+ mcSubMenuItem.name);
                     mcSubMenuItem.x=mcMenuHolder.x+20;
                     mcSubMenuItem.y =mcMenuHolder.y;
                     //kglad's addition
                     mcSubMenuItem.y+= nextBtnY;
                     nextBtnY+=subtopicSpace;    
                     global_subi.text = String(jCount);
                mcSubMenuItem.lExtend.visible = false;  
    global_i.text = String(i);
    Then I try to access the clips like so:
    -The first for-loop access the topic movie clips, no problem, and traces out scContent correctly.
    -The second for-loop traces out null everytime, when I would expect it to be tracing out the names of the subtopic movie clips.
    function accessClips(){
         //This will access the topic movie clips
         for(var i:Number=0;i<Number(global_i.text);i++)
               var scMenuItem:String = "mcMenuItem" + i;
               var scContent:Object = this.getChildByName(scMenuItem);            
               trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scContent:Object = "+ scContent);
         //This is supposed to access the subtopic movie clips
         for(var j:Number=0;j<Number(global_subi.text);j++)//
               var scSubMenuItem:String = "mcSubMenuItem" + j;
               var scSubContent:Object = this.getChildByName(scSubMenuItem);
               trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scSubContent:Object = "+ scSubContent);
    Hope this makes sense, Chipleh confused. If the code is not clear enough, let me know and I'll try to further clarify.
    Thanks again,
    ~Chipleh

  • Copying movie clip with flv

    Hi, I am trying to copy a movie clip with an flv in it from
    one project to another. Everything works fine except the flv just
    keeps trying to load and never plays. I am not sure what to do. Any
    suggestions?

    It sounds like you are using the FLVPlayback component to
    display the FLV, in which case, the FLV is a separate file and
    likely needs to be in the folder next to the new project. Go back
    to the old project and copy the FLV from its location there to the
    new projects folder.

  • Moving movie clips with ActionScript

    I am trying to move four movie clips with actionscript in a
    circler motion with two buttons, one to rotate the mc’s to
    the left and one button to rotate the mc’s to the right. Here
    is a link to what I am trying to do;
    http://www.us.playstation.com/Lair/
    and it is undrer game features.

    Yes, that's what the code I gave you is intended to do....
    you replace that code with whatever action you need to take to turn
    your movie around.
    I have no idea what your movieclip is doing, but I'm guessing
    by your response that if it was an arrow pointing left to right
    (just an example), you want it to be pointing right to left when
    the left arrow is pressed. If you want an immediate turn around,
    then the simplest way to do that is to have another frame
    containing the movieclip that it moves to where it faces the other
    direction--and to have it appear turned around, from the toolbar
    you select Modify -> Transform -> Flip Horizontal.
    So the movieclip would live inside another movieclip that has
    two frames with stop()'s for each frame. In the first frame you
    would have the subclip facing left to right, and in the second you
    would have it facing right to left. If we call that 2-framed
    movieclip "walker", the code I provided before would
    become...

  • Exporting a move clip with alpha channel

    Hi there,
    I’m trying to export a move clips with alpha channel.
    I’m trying to export an animation with Premiere CS5. I made an animation of a rotating object in Maya and exported it with alpha channel as tiff images. Then they are edited with Photoshop to give them a drop shadow.
    My problem is this. Can I export this tiff animation with the alpha channel?
    My plane is to use move clips over backgrounds in a game – depending on the result there are different animations playing on top of several different backgrounds. There for the objects has to have a transparent/alpha channel over the backgrounds.
    Again the reason for this is the complexity of the game and to make the game looking as real as possible. I’m hoping for some help here to make my plan possible
    …thanks

    Thanks alot for the help.
    But now I’m wondering how to get the file size down?
    The 32bit and alpha channel just increase the file size from about 1MB to 9,3MB, which is pretty much??
    …any ides mate?

  • I am unable to access rotten tomato film clips with safari

    I am unable to access rotten tomato film clips with Mac 10.6.8 with Safari server 5.1.10  Only a black screen shows.  I have latest version of Adobe flash installed.  I have allowed in my Safari preferences to allow Java and all other plug ins.

    Safari 5.1.10 is not being updated and doesn't meet all current web requirements. Try another browser as a test.
    Firefox

  • Printing a movie clip with dynamic text boxes

    I've got a certificate inside a movie clip, and i want the
    dynamic text box to dispay the user name, but for some reason it is
    coming up undefined, even though i have the dynamic text box set to
    finalname = _root.inputname, but it comes up as undefined on the
    screen. :( Can anyone tell me where i am going wrong?
    Is there a way to print just a specific movie clip on the
    screen? I can only print all the frames in the movie and without
    the dynamic text box... any help would be greatly
    appreciated.

    assign the mouseChildren property of your movieclip to false.

  • What type of movie clips are handled by the ipad? I have shot a movie clip with my canon camera and the file is .AVI.  will this load onto ipad?

    what type of movie clips are handled by the ipad? I have shot a movie clip with my canon camera and the file is .AVI.  will this load onto ipad?

    Per http://www.apple.com/ipad/specs/
    AirPlay Mirroring to Apple TV (2nd and 3rd generation) at 720p
    AirPlay video streaming to Apple TV (3rd generation) at up to 1080p and Apple TV (2nd generation) at up to 720p
    Video mirroring and video out support: Up to 1080p with Apple Digital AV Adapter or Apple VGA Adapter (adapters sold separately)
    Video out support at 576i and 480i with Apple Composite AV Cable (cable sold separately)
    Video formats supported: H.264 video up to 1080p, 30 frames per second, High Profile level 4.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format

  • Noob help: Triggering Movie Clips with Buttons

    Hi guys,
    I'm taking an intro Flash and Action Script class and for my final I need to create a portfolio project that contains 5 unique buttons that trigger 5 unique movie clips. I'm having a hard time with this. I've been able to trigger the 1st movie clip with the first button (although I can't stop it) but I can't trigger any ohter movies with any other buttons.
    Here's my code:
    stop();
    chuck1_btn.addEventListener(MouseEvent.CLICK, playMovie);
    function playMovie(event:MouseEvent):void
        spaceship_mc.play();
    chuck2_btn.addEventListener(MouseEvent.CLICK,playSaucers);
    function playSaucers(event:MouseEvent):void
        saucers_mc.play();
    Nothing happens when I click on chuck2_btn when I test the movie. I think I need to create a variable or class but I'm not sure. I'm a super noob with this stuff. Any thoughts? Thanks!
    Rick

    You should learn how to use the Help documentation to find answers like how to use the visible property.  For the code you showed earlier, here's what you can try in frame 1 to replace it.
    stop();
    spaceship_mc.visible = false;
    saucers_mc.visible = false;
    slideshow_mc.visible = false;
    chuck1_btn.addEventListener(MouseEvent.CLICK, playMovie);
    function playMovie(event:MouseEvent):void
         spaceship_mc.visible = true;
         saucers_mc.visible = false;
         slideshow_mc.visible = false;
        spaceship_mc.play();
    chuck2_btn.addEventListener(MouseEvent.CLICK,playSaucers);
    function playSaucers(event:MouseEvent):void
         spaceship_mc.visible = false;
         saucers_mc.visible = true;
         slideshow_mc.visible = false;
        saucers_mc.play();
    etc...
    It could be refined, like having a function that hides everything and using that every time before making the one you need to show visible.  You might find it necessary to include telling the movies to gotoAndStop(1) as well.
    That's about as generous as I'm going to get.  It's important that you learn things, and handing you a solution isn't going to help do that.

  • Check for movie clips with AS?

    Is it possible to check if a frame contain a movie clip with
    AS, and then if movie clip is found run a function? Like a global
    "event handler " for movie clips.

    I want a function that automaticly can detect and fade in any
    movie clip found in any keyframe in the main timeline. So i don't
    have to make
    In the first keyframe in the main timeline
    on (ohh here i found a movie clip)
    //let's run a nice fade function on that movie clip
    mx.transitions.TransitionManager.start
    (eval(TheClip),
    {type:mx.transitions.Fade,
    direction:0,
    duration:1,
    easing:mx.transitions.easing.None.easeNone,
    param1:empty,
    param2:empty
    Something like that

  • HT204266 I have redeemed points on my account but, when I try to buy a song I tunes doesnt use them it tries to access the credit card associated with the account for payment.

    I have redeemed points on my account but, when I try to buy a song I tunes doesnt use them it tries to access the credit card associated with the account for payment. How do I tell this thing to use the points instead. duh

    By 'redeemed points' I assume that you mean that you've redeemed an iTunes gift card onto your account (?). If you do then are you trying to buy songs for yourself or are you trying to gift them - you can only gift items from a credit card, an account's balance can't be used for gifting. If you are buying for yourseflt and you are being asked to enter/verify a credit card number then are you currently in the country where your iTunes account is based ?

  • Trying to remove movie clip with collision?

    I am creating empty movie clips and populating them with
    movie clips that have "drag and drop" functionality. I can create
    the empty movie clip and populate it with an external .swf. I've
    even got the drag-n-drop handled. But, I'd like to have them delete
    or disappear when they are dropped onto a trash can movie clip. I
    just can't seem to figure out the code for this. I would greatly
    appreciate any help you could give me.
    Thanks.

    you need to perform a hitTest to determine if the item is
    within the bounds of your trashcan, you can also use _droptarget,
    but I prefer hitTest with a shapeflag parameter. depending on your
    code, when you call stopdrag onRelease, run your test there.
    the_mc.onRelease = function() {
    stopdrag();
    if(_level0.trashcan.hitTest(_xmouse, _ymouse, true)) {
    this.removeMovieClip();
    }

  • Play multiple movie clips - with sound

    Hello Forum members,
    I am a total new comer in terms of flash and action script,
    self-educated and Adobe forum and internet educated. I can now
    click a button and stop and start a movie clip, use attachMovie,
    and even mute sound in a movie clip (not video). I am currently
    using Flash 8, and waiting for CS3 (downloaded a trial, and like it
    better than Flash 8).
    Enough history - now to my question - I have an application
    that had 3 scenes. I read in some Adobe article
    "Flash Best Practices" that it was not a good idea to use
    scenes in an application. I converted my Scene 2 and Scene 3 into
    movie clips.
    I figured I could either put each movie clip on a separate
    layer in my timeline (mc_scene2, mc_scene3)
    and play them, one after the other (did not quite work, more
    later). Or...
    copy the timelines from the scenes, and add those frames to
    my Scene 1, making a application with both scenes staggered one
    after the other in the main timeline. Or...
    Keep Scene 1 and at the end of scene 1,
    attacheMovie("mc_scene2", etc) and when scene 2 was done play and
    or attach the final movie clip (mc_scene3).
    I could not figure out how to tell when mc_scene2 was done
    using the attacheMovie method, so I could then attach mc_scene3,
    etc.
    How would I be able to tell when one attached or loaded movie
    clip is finished, and then start the next one?
    Or what is the suggested way to use actionscript to load a
    movie, play it, and when the clip is done, load and play the next,
    etc.
    Thanks for a good forum,
    eholz1

    Hello Again - I guess there is much that I do not understand.
    I followed the tip above - or so I thought.
    I have "buttons" on my movie clips that play the clip when
    clicked.
    I have placed stop actions in frame 1 of each movie clip.
    I tried placing mc_scene2 and mc_scene3 on their own layer
    in the timeline,
    and put the code above in my actions layer (Scene 1).
    it seems that nothing really works - the _visible property
    seems not to work,
    etc - I must be doing something wrong. What layer should the
    two mc's be
    placed?
    Thanks for the info
    Eholz1

  • How to play a movie clip with a tween animation

    I created a movie clip symbol with a tween animation and created an instance of it on the main stage. The animation is in the movie clip timeline, not on the main timeline. I cannot get the mc to play using mc.play() or mc.gotoAndPlay.  What am I missing??

    Hi Ned, thanks for the response;
    1.Yes I named the instance.
    2.I  don't beleive so. I started from the library creating a new symbol, added the graphics, added the key frames, then created the tween. Then I dragged the symbol onto the main stage and named the instance. So I don't think there is a movie clip inside an mc.
    Here is the main timline:
    Here is the mc timeline:
    Here is what I'm trying to do:
    stop();
    blk1._visible = false;
    blk2._visible = false;
    blk3._visible = false;
    ppk1._visible = false;
    ppk2._visible = false;
    ppk3._visible = false;
    storeCartons = new Array();
    storeCartons = [blk1, blk2, blk3, ppk1, ppk2, ppk3];
    startButton.onRelease = function() {
        myNumber = Math.floor(Math.random()*storeCartons.length);
        trace("myNumber "+myNumber);
        activeCarton = storeCartons[myNumber];
        activeCarton._visible = true;
              activeCarton.play();

Maybe you are looking for

  • Does Mac equivalent  to Adobe Audition/CoolEdit Pro exist?

    Audacity lacks the feature set though the price point makes it attractive. The versions of Bias Peak I've used are slow & cumbersome and don't have multitrack editing capabilities. Bias Deck has multitrack support but still requires you to have Bias

  • Edge update problems: to download previous version...

    Hi For those people who are having problems with the update to Edge Animate CC 2014.1 and have deadlines to meet (and I count myself among them!), earlier versions are still available from Adobe, so its possible to revert to your preferred version. G

  • Can somebody please help?

    I am having difficulty all of a sudden video chatting with my family who have PCs. We all have AIM accounts and it's been working just fine until now. I have read everything on these discussions, tried things I thought would do it and nothing is work

  • LJ 1300 printing horizontal lines and "echoes" every 1.5 - 2 "

    Hi there, We have an LJ 1300 (it's older, but **bleep** solid..).  It's started printing horizontal lines, almost line a dirty roller, or cartridge. We also get "echoes". So if you print a windows test page, you get the well printed "Windows Test pag

  • Removing the "next" and "previous" buttons in the slideshow

    Hi all, I added an html snippet so once you click on my link, it bypasses the album mode and goes straight to the single pict mode. I like it because for me, it seemed like an extra step. So, now that I don't want to use album mode- i want to remove