Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6391509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:40:49+00:00 2026-05-25T03:40:49+00:00

I’ve created a button in Flash, and inside that I have a TextField and

  • 0

I’ve created a button in Flash, and inside that I have a TextField and a MovieClip, both with instance names set. They cover all 4 frames of the button, with no keyframes.

I found I couldn’t access the objects using the instance names I’d set, so I used this piece of code to see what’s going on:

var obj:DisplayObject = this.m_graphics.btnChange.upState;
for ( var i:int = 0; i < obj.numChildren; i++ )
{
    trace( "We have an object at " + i + " - " + obj.getChildAt( i ) + ": " + obj.getChildAt( i ).name );
    var t:TextField = obj.getChildAt( i ) as TextField;
    if ( t == null )
        continue;

    trace( "  The textfield has text '" + t.text + "' );
}

I get this as output:

We have an object at 0 - [object Shape]: instance195
We have an object at 1 - [object TextField]: instance199
  The textfield has text 'Change'
We have an object at 2 - [object MovieClip]: instance203

So they TextField and MovieClip are there, they’ve just had their instance names reset to the generic “instance###”.

Anyone know what the problem is? If I make the button a MovieClip, it works fine (though I have to control the frames myself).

I’m aware of the different methods I could use to work around this, but that means changing a lot of things, and I’d like to know why SimpleButton’s ignore the instance names set in Flash

EDIT

Looking into it a bit further, it seems that even though there’s no keyframes in the button in the Flash IDE, Flash creates 4 instances of each item (tracing through the upState for example will give me a TextField with the instance name “instance2”, while in the downState, the instance name is “instance4”). If I change the text in one state, it doesn’t reflect in the others.

I’m thinking that when Flash creates the objects, it’s not copying over all the properties properly (namely the instance name)

EDIT

I agree that Shane’s answer is a workaround – I’d said it myself that I know of the different methods to get around the problem – but it ignores the problem, it doesn’t solve it (it’s the only reason why I haven’t accepted it). I came to SO in the first place to see if someone perhaps knows why it’s happening in the first place (tbh, it seems like a bug in the SDK).

I also understand the reasoning behind the argument “you shouldn’t access children in SimpleButton; if you want more control, use Sprite or MovieClip”, but I don’t agree with it. The Flash IDE lets you create buttons with named instances inside them, and the SimpleButton docs give you access to the different states, so for me, this is accepted behaviour. If SimpleButton can only be used for very basic, non-changeable static buttons (think localisation as well), then it’s pretty useless. You can use Sprite and MovieClip, but then you have to control the different states yourself, which gets awkward. I have my own Button class to handle the boilerplate, but I shouldn’t have to rewrite basic SDK functionality, which is why for me it’s a bug.

I’ll keep the bounty open for the time it’s there. If I get nothing else, then I’ll give it to Shane.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:40:49+00:00Added an answer on May 25, 2026 at 3:40 am

    This is because the flash.display.SimpleButton class does not inherit from DisplayObjectContainer, and the state containers are also not DisplayObjectContainers: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/SimpleButton.html

    Basically, simple buttons are by their definition simple. If you want more complex control over the inner objects you will have to use a Sprite or MovieClip with buttonMode set to true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.