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

Yet Another Convert AS1 to AS3

Participant ,
Jan 28, 2014 Jan 28, 2014

Shouldn't be too hard!

I adopted someone else's older Flash project, and I need to update it.

I have a map featuring several buttons on various cities. One button, with many instances, named accordingly.

Roll over a button instance, and it goes to the appropriate label on a MC timeline, showing the appropriate text.

How do I update this to AS3?

_root.seattle.onRollOver = function ()

{

_root.text.gotoandstop("seattle");

}

Seattle is the button instance name, text is the MC name and the seattle is the MC label name.

I'll end up with this code repeated many times, for each of the different buttons.

Any help?

Thanks.

TOPICS
ActionScript
901
Translate
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
Guru ,
Jan 29, 2014 Jan 29, 2014

import flash.events.MouseEvent;

root.seattle.addEventListner(MouseEvent.ROLL_OVER, roHandler);

function roHandler(e:MouseEvent):void{

root.text.gotoAndStop("seattle");

}

Translate
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 ,
Jan 29, 2014 Jan 29, 2014

Thank you!  Making progress.

I fixed your typo Listner to Listener, but I get two compile errors:

Scene 1, Layer 'Actions', Frame 1, Line 191119: Access of possibly undefined property text through a reference with static type flash.display:DisplayObject.

Scene 1, Layer 'Actions', Frame 1, Line 151119: Access of possibly undefined property seattle through a reference with static type flash.display:DisplayObject.

My code:

     stop();

     /* Rollover button command

     */

     import flash.events.MouseEvent;

     root.seattle.addEventListener(MouseEvent.ROLL_OVER, roHandler);

     function roHandler(e:MouseEvent):void{

     root.text.gotoAndStop("seattle");

     }

When I test this movie, it loops endlessly. I have stop commands in place (main timeline AND the MC), but...what am I missing?

Thanks again.

Translate
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
Guru ,
Jan 29, 2014 Jan 29, 2014

its not a good idea to name a movieclip exactly like a common property.

try renaming it to CityLabels or sth.

Seattle is the button instance name, text is the MC name and the seattle is the MC label name.

Honestly, I have difficulties to understand what you are tring to communicate here.

if Seattle is a SimpleButton instance, you should convert it to a MovieClip, since SimpleButtons have some drawbacks when trying to overlay your own eventlisteners.

There is also sth. wrong with the nesting of your string component

Translate
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 ,
Jan 30, 2014 Jan 30, 2014
LATEST

Well, as I'm not exactly a developer nor am I very fluent in AS3, I did my best to communicate my needs and my current code.

I'm going to go in another direction with this project, and try roll over buttons that go to a different frame with text on it.  On roll out, go back to frame 1 and stop.  I don't know how else to do it.

The project file I have now is AS1, and a button instance commands a MC to go to a frame number, but I don't know how to get a button and a MC to work together.

Thank you.

Translate
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