PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
[RESOLVED] MovieClip Reference nightmare
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] MovieClip Reference nightmare

  1. #1
    Member
    Join Date
    Mar 2007
    Posts
    79

    resolved [RESOLVED] MovieClip Reference nightmare

    Hi,

    I've been working on a project the last few days in AS2 and decided I'd try and re-write it in AS3 as I'm yet to venture in to the AS3 world.

    I've done most of the conversion, but I'm stuck on what should be an easy problem.

    I'm loading images from an xml.
    The images get put into movieclips.
    mcholder.image_mc.nmc0
    mcholder.image_mc.nmc1
    mcholder.image_mc.nmc2
    mcholder.image_mc.nmc3 .......

    I have a function that resizes the images when the stage is resized.
    This then runs another function to update an array of the image widths.
    The problem I have is trying to update the new widths into an Array. I just can't seen to reference my MC's to get the widths!

    Actionscript Code:
    function checkImages () {
        for (var i:int = 0; i < imageHolders.length; i++){
            var prevX = ["mcholder.image_mc"+imageHolders[i][1]]; //name
            var MC = prevX; //This out puts mcholder.image_mc0 .....
                  //var MC = prexX.width; // This outputs undefined
            trace (MC + " Old Width"); //
        }
    }

    imageHolders is an array. imageHolders[i][0] contains the current width.
    imageHolders [i][1] container the nmc.name

    I stumped as to why I can get the properties of these items.
    The only thing I can think of is that I have 'nmc.name' during the mc creation.

    Actionscript Code:
    function onComplete(event:Event):void {
        var mc = event.target.content;
        mc.smoothing = true;
        mc.alpha = 0;
            var nmc:MovieClip = new MovieClip();
        nmc.pos = count;
        nmc.name = "nmc" + count;
            var nmcname = nmc.name;
        var porp = mc.width / mc.height;
        mc.width = stage.stageHeight * porp;
        mc.height = stage.stageHeight;
        nmc.addChild(mc);

    Any ideas?

  2. #2
    Member
    Join Date
    Mar 2007
    Posts
    79
    Ok, I think I've solved my problem with a newly learnt 'getChildByName.

    Actionscript Code:
    preX = mcholder.image_mc.getChildByName("nmc"+i);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center