Tuesday, March 30, 2010

quick questions converting from AS2 to 3

Is the following code correct AS3??should ''flash.display.loader'' occur in the manner shown below?

Is ''package'' a generic name or should it be customized??

Thanks for your help and suggestions--just getting back to Flash after a few years...sorry about the basic questions.

var message:Number = 0;

var requested_message:Number = 0;

package {

import flash.display.MovieClip;

import flash.ui.Mouse;

import flash.events.MouseEvent;

import flash.text.TextField;

MovieClip(root).stage_target_mc.internal_stage_target_mc.flash.display.loader(''m essage_displayed''+message+''.swf'');

next_btn.addEventListener(MouseEvent.MOUSE_DOWN, next_message);

function next_message (event:MousEvent):void {

?message = ++message;

?MovieClip(root).stage_target_mc.internal_stage_target_mc.flash.display.loader('' message_displayed''+message+''.swf'');

};

MovieClip(root).stop();

};

quick questions converting from AS2 to 3

package is a keyword and never changes.?you can add text after package to indicate a package name/location.

and no, your code doesn't look ok.?to start, all code should follow the brackets after package and variable declarations needed outside of functions should be after a class name and before the class constructor.

you should check some sample class files, if that's what you're trying to create.

quick questions converting from AS2 to 3

Thanks for your help!?A few more specific questions:

When trying to update:

_root.stage_target_mc.internal_stage_target_mc.loadMovie(''message_displayed''+mes sage+''.swf'');

to AS3:

MovieClip(root).stage_target_mc.internal_stage_target_mc.flash.display.loader(''m essage_displayed''+message+''.swf'');

no, it wouldn't.


to update:

_root.stage_target_mc.internal_stage_target_mc.loadMovie(''message_displayed''+mes sage+''.swf'');

to AS3:

MovieClip(root).stage_target_mc.internal_loader.load(''message_displayed''+message +''.swf'');

MovieClip(root).stage_target_mc.internal_stage_target_mc.load(''message_''+message _displayed+''.swf'');

that's not what i typed.

for your code to work:

internal_stage_target_mc needs to be a loader on the stage_target_mc timeline.

and you're correct, the url should be:?new URLRequest(''message_''+message _displayed+''.swf'')

''and you're correct, the url should be:?new URLRequest(''message_''+message _displayed+''.swf'')''

wow thanks for the guessing game this was fun

you're welcome.

  • facebook layouts
  • No comments:

    Post a Comment