• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do you force instances with the same name on the same layer to update?

Guest
Jul 03, 2008 Jul 03, 2008

Copy link to clipboard

Copied

Maybe someone can tell me why flash doesn’t redraw components’ x,y positions if they have the same instance name and are on adjacent frames? (movieclips work fine, just not components) If I have a button on frame 1 and a button on frame 2 both with the same instance name but different locations on the stage, frame 2’s button doesn’t show up in the position I placed it, it stays at the position of frame 1 but still has the properties of frame 2’s button. The label changes and everything. If I stick a button on a frame in between and give it a different instance name there is no problem. I thought it might be the style manager bug http://www.gskinner.com/blog/archives/2007/12/cs3_component_b.html but it didn’t seem to affect. This happens for textareas too and probably all components although I haven’t tried them. I’ve tried using drawNow() and validateNow() with no luck either http://www.adobe.com/devnet/flash/articles/creating_as3_components_pt3_05.html

Thank you!

// put this on frame 1 along with a button on the stage with instance name: b
function doit(event) {
if (currentFrame == 1)
gotoAndStop(2);
else
gotoAndStop(1);
}
b.addEventListener(MouseEvent.CLICK, doit);
stop();

// put another button on frame 2 along with this code and also make it’s instance name: b but move it so it’s not in the same x,y coordinates as the button on frame 1
stop();


Something possibly related. I have a movieclip on a layer, one instance with name “a” on frame 1 and one instance with name “a” on frame 2 and it has event listeners inside it that update something on the movieclip. Unless I put the movieclips on separate layers the event listeners won’t reset each frame. (example: a button with a tooltip onmouseover that you want to change the text of from frame 1 to frame 2) You’d think if they were on separate keyframes at least but no, they need to be on separate layers too.

I want the movieclip to update each frame. Any ideas?
TOPICS
ActionScript

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2008 Jul 04, 2008

Copy link to clipboard

Copied

instances (whether components or not) with the same name may or may not be the same instance. it depends upon how they were created.

for example, if you create an instance on frame 1 of your main timeline, give it an instance name and then create a keyframe on frame 2, the two instances will be the same.

but if you create an instance on frame 1 of your main timeline, give it an instance name and then create a blank keyframe on frame2 and create another, what you think is a duplicate, instance and give it the same name, it will be a different instance.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

either way you do it, blank keyframe or just keyframe, the results are the same.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

then you're doing something wrong. a blank keyframe removes the previous instance and any code that affected it will have no affect on any subsequent movieclips/components.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

Then it's a bug in Flash. See for yourself.
Create a new flash 9 AS3 project and put a button on frame 1 at the top of the stage and then add a blank keyframe about 12 frames out and put a button at the bottom of the screen. Add another 12 frames or so. Instance names can be left blank or be the same.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

as expected, i see a button component at the top of the stage followed by an empty stage followed by a button component at the bottom of the stage etc.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

I appreciate your help with this issue.
There should be no empty stage. Did you put a blank keyframe in between the first button and the second button? If frame 1 has a button and frame 2 has nothing and frame 3 has a button then yes it works. I'm talking about frame 1 having a button and frame 2 having a button (or 1-12 having a button and 13-24 having a button) and no blank space between. they're adjacent frames. Does that too work for you?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

you can explicitly set the x and y properties of the button in script in each frame, and therefore make the button appear wherever you want it to be.

That solves the problem, but doesn't explain why the behavior that you describe occurs. (I did see what you described.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

LATEST
yes, i inserted a blank keyframe after the first button was to be removed and yes, i was describing an empty stage for several frames.

if you don't want an empty stage at any frame in the timeline, put the buttons in different layers.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines