Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

how do i link a class to only one scene in the fla file ?

New Here ,
Jan 29, 2013 Jan 29, 2013

hi

so am running a project on flash cs5 contain 4 scene

scene 4 is a a flash game with 2 classes

after finishing the game codes and testing and work fine

i found that the hole document using  the class of the game

so when testing movie many errors appears

is there any way to link this class to the game scene only ?

or any another solution makes the project work ????

TOPICS
ActionScript
5.8K
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

correct answers 1 Correct answer

Community Expert , Jan 29, 2013 Jan 29, 2013

no, don't import the swf, load the swf:

on scene4:

var loader:Loader=new Loader();

addChild(loader);

loader.load(new URLRequest("game.swf"));  // assuming you created game.swf as suggested in message 1.

Translate
Community Expert ,
Jan 29, 2013 Jan 29, 2013

create a new fla, assign your game class to the document class of the new fla and publish a game swf.  then load that game swf in scene 4.

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
New Here ,
Jan 29, 2013 Jan 29, 2013

well i had a problem adding swf to my main project ( i made the game 3 times because of that ) !

can u tell me how to add swf to my scene

what i want in my main project

i need the use when going into scene 3 click on the button and go to scene 4 and play the game ?

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
New Here ,
Jan 29, 2013 Jan 29, 2013

any help !!

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
Community Expert ,
Jan 29, 2013 Jan 29, 2013

i just explained how to do that.  what is that you don't understand?

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
New Here ,
Jan 29, 2013 Jan 29, 2013

I'm Sorry I'm Biggner

i meant

before i faced this problem i tried to create a scene including the game swf but its not working

i need to know the way to create the scene that load swf and work correctly

am i supposed to import the swf into stage and nothing else

or there a working way that i dont know about

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
Community Expert ,
Jan 29, 2013 Jan 29, 2013

no, don't import the swf, load the swf:

on scene4:

var loader:Loader=new Loader();

addChild(loader);

loader.load(new URLRequest("game.swf"));  // assuming you created game.swf as suggested in message 1.

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
New Here ,
Jan 29, 2013 Jan 29, 2013

really i dont know how to thank u

u r genius

thank u so much

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
Community Expert ,
Jan 29, 2013 Jan 29, 2013

you're welcome.

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
New Here ,
Jan 31, 2013 Jan 31, 2013

its me again :S

i load the swf file and its work perfect

but i want to set a back button

make the user go to scene 3 any time in the game

but it didnet work i try :

- in the game fla i set the button from code snippts but not working may be i should put the code on the class but i dont know the code ??

in the main fla i set the back button on the scene that load swf bit its not working

so any chance i can find a help :s ?

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
Community Expert ,
Jan 31, 2013 Jan 31, 2013

where is the back button?

in your main swf or in the loaded swf?

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
New Here ,
Jan 31, 2013 Jan 31, 2013

in the loaded swf

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
Community Expert ,
Jan 31, 2013 Jan 31, 2013

if it's on the main timeline of the loaded swf use:

back_btn.addEventListener(MouseEvent.CLICK,backF);

function backF(e:MouseEvent):void{

Loader(this.parent).unloadAndStop();

}

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
New Here ,
Jan 31, 2013 Jan 31, 2013

where i put that code

on code snippets of the button

or in the game class ?

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
Community Expert ,
Jan 31, 2013 Jan 31, 2013

put that on the main timeline of the loaded swf.  make sure you button's reference matches the code reference.

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
New Here ,
Feb 02, 2013 Feb 02, 2013

i got so many errors when using the unload code u gave me but may be i do it wrong

look

i'm in my main fla project

scene 4 have that code i get it from u in the first frame to load game.swf

in scene 4 i set a button (instance name "back_bt") to get back to scene 3

what i should do exactly ! is there any way to use code snippts i tried the load/unload but still dont know how toggle it to unload !!

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
Community Expert ,
Feb 02, 2013 Feb 02, 2013

in message 11 you told me the back button is in the loaded swf.

if it's not, use:

back_bt.addEventListener(MouseEvent.CLICK,backF);

function backF(e:MouseEvent):void{

loader.unloadAndStop();

}

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
New Here ,
Feb 02, 2013 Feb 02, 2013

wired thing just happen

every time i click to the button in scene 3 to go to scene 4 (the game )

it gives me another scene

even when i delete the load code and scene 4 become empty scene

still when testing the movie gave me another scene

i checked to click and go to scene again and again every thing fine the names of scenes the code from code snippts

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
Community Expert ,
Feb 02, 2013 Feb 02, 2013

go back to a previous fla version where your scene 3 to scene4 button worked.

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
New Here ,
Feb 02, 2013 Feb 02, 2013

from where i can do that ?

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
Community Expert ,
Feb 02, 2013 Feb 02, 2013

that's programming 101.

101a: save your work frequently.

101b: use a naming scheme that reveals advancing versions (eg, myproject_01, myproject_02, etc)

you apparently have not learned that yet.  so, start now.

what code does your scene 3 button use to advance to scene 4?

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
New Here ,
Feb 02, 2013 Feb 02, 2013

yeah seems i have long way to learn flash

in scene 3 code to scene 4

game_bt.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_15);

function fl_ClickToGoToScene_15(event:MouseEvent):void

{

          MovieClip(this.root).gotoAndPlay(1, "shgame");

}

and thats code from code snippts

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
New Here ,
Feb 02, 2013 Feb 02, 2013

great news

i fix the latest problem and its work again and save it

now i used ur code to unload the swf and back to scene 3

and its worked fine its unload and got me back to scene 3 "but"

its back to scene 3 and delete the button that advance to scene 4 ?

i put the code after the load code

and after it i put the code

click to scene

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
New Here ,
Feb 02, 2013 Feb 02, 2013

thats the error after getting back to scene 3 and delete the button

TypeError: Error #1009: Cannot access a property or method of a null object reference.

          at shdone_fla::MainTimeline/frame340()

          at flash.display::MovieClip/gotoAndPlay()

          at shdone_fla::MainTimeline/fl_ClickToGoToScene_19()

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
Community Expert ,
Feb 02, 2013 Feb 02, 2013

what button are you trying to "delete" and what code are you using?

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