The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • ActionScript
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 ActionScript

  • BSMH Author 
    • 165 
    • 0 
    • 0 
    Is this correct?
    Isocase

    No comments yet

    Be the first to comment

    Posted: Nov 10 2009, 11:53 AM

    by BSMH

     

This post is a culmination of many answers combined together.  So I want to make sure I understand.

In order to add an mc to the stage from the library, you refer to it by its name in the library.  The way all of this is done is:

var someMc:String = "this_mc";
newClass = getDefinitionByName(someMc);
mcAdded= new newClass ();
addChild(mcAdded); 

If I wanted to name the mcAdded before its added to the stage would I then use “mcAdded.name = someName” before the addChild?

Here is where things have always been fuzzy.  If I wanted to edit the mcAdded after it’s been added to stage, I would:

var someString:String = "mcAdded";
var 
selectedInstance = getChildByName( someString);

selectedInstance.x = 210; 

I’ve had problems with accessing the instances on the stage in the past.  It seems the names of MCs I add to the stage via code are usually messed up.  Sometimes their called something like “instance 47”.  Sometimes [object mcAdded].  How do I fix this so I can guarantee that the names of all future instances are predictable?  Is there a better way to handle all of this?

  0 REPLIES
 
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 779  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,728  Assets
  • Profiles 282,751  Members
  • Topics 93,776  Topics
  • Blog 4  Blog
  • Facebook 1,679  Facebook
  • Twitter 1,163  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 11, 2012 - 19:50:53