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

Need help integration a AS3 drawing game into a .fla

Explorer ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

Hi,

I created a drawing game by following a tutorial on this website : http://code.tutsplus.com/tutorials/create-a-basic-drawing-application-in-flash--active-1627

It was pretty straight forward. (you can download the source file to have the same code as me and save time).

Now to the fun part!

I previously created an iPad app in Flash. Works great by the way and is published on the App Store. (Search for : Henri Godon -> free app)

My client wants this drawing game to be incorporated in his app with a possibility of 3 different images to color opon. Which is pretty easy to do.

I thought that just doing a simple copy/paste and including the scripts would do the trick.... WRONG! I keep getting errors once I try to export it or test it out.

My App works great without the game. And the game works great alone. It's only one I try to embed it that I'm stuck.

Here are my errors, hope someone has an easy DIY way that I'm not aware of since I have never done this before.

ERROR 1:

1037 : Packages cannot be nested.

here is what it is referring to in the Main.as script :

package

{

  import PNGEncoder;

  import flash.display.MovieClip;

  import flash.display.Shape;

  import flash.display.DisplayObject;

  import flash.text.TextField;

  import flash.text.TextFormat;

  import flash.text.TextFieldType;

  import flash.text.TextFieldAutoSize;

  import flash.display.BitmapData;

  import flash.geom.ColorTransform;

  import flash.events.MouseEvent;

  import flash.events.Event;

  import flash.utils.ByteArray;

  import flash.net.FileReference;

  public class Main extends MovieClip

  {

ERROR 2:

Even if I try to remove that part, then I get an other error saying

1114: The public attribute can only be used inside a package. (which is kinda obvious)

1084: Syntax error: expecting leftbrace before var.

So nothing works after that...

I added the Main.as in the ActionScript setting in the Document class. So I know it is loaded in a way, but after that I'm stuck!

Please help out! I'll do anything.

TOPICS
ActionScript

Views

2.5K

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

correct answers 1 Correct answer

Community Expert , Jun 18, 2015 Jun 18, 2015

var loader:Loader=new Loader();

var lc:LoaderContext = new LoaderContext(false,ApplicationDomain.currentDomain,null);

loader.load(new URLRequest('yourgameswf.swf'),lc);

addChild(loader);

Votes

Translate

Translate
Community Expert ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

you have mismatched curly brackets in your class.

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
Explorer ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

not too sure where... Here is the complet Main.as code :

package

{

  import PNGEncoder;

  import flash.display.MovieClip;

  import flash.display.Shape;

  import flash.display.DisplayObject;

  import flash.text.TextField;

  import flash.text.TextFormat;

  import flash.text.TextFieldType;

  import flash.text.TextFieldAutoSize;

  import flash.display.BitmapData;

  import flash.geom.ColorTransform;

  import flash.events.MouseEvent;

  import flash.events.Event;

  import flash.utils.ByteArray;

  import flash.net.FileReference;

  public class Main extends MovieClip

  {

  /* Variables */

  /* Pencil Tool shape, everything drawed with this tool and eraser is stored inside board.pencilDraw */

  var pencilDraw:Shape = new Shape();

  /* Text format */

  var textformat:TextFormat = new TextFormat();

  /* Colors */

  var colorsBmd:BitmapData;

  var pixelValue:uint;

  var activeColor:uint = 0x000000;

  /* Active var, to check wich tool is active */

  var active:String;

  /* Shape size color */

  var ct:ColorTransform = new ColorTransform();

  public function Main():void

  {

  textformat.font = "Quicksand Bold Regular";

  textformat.bold = true;

  textformat.size = 16;

  convertToBMD();

  addListeners();

  /* Hide tools highlights */

  pencil.visible = false;

  hideTools(eraser, txt);

  }

  /* Pencil Tool */

  private function PencilTool(e:MouseEvent):void

  {

  /* Quit active tool */

  quitActiveTool();

  /* Set to Active */

  active = "Pencil";

  /* Listeners */

  board.addEventListener(MouseEvent.MOUSE_DOWN, startPencilTool);

  board.addEventListener(MouseEvent.MOUSE_UP, stopPencilTool);

  /* Highlight */

  highlightTool(pencil);

  hideTools(eraser, txt);

  ct.color = activeColor;

  shapeSize.transform.colorTransform = ct;

  }

  private function startPencilTool(e:MouseEvent):void

  {

  pencilDraw = new Shape();

  board.addChild(pencilDraw);

  pencilDraw.graphics.moveTo(mouseX, mouseY);

  pencilDraw.graphics.lineStyle(shapeSize.width, activeColor);

  board.addEventListener(MouseEvent.MOUSE_MOVE, drawPencilTool);

  }

  private function drawPencilTool(e:MouseEvent):void

  {

  pencilDraw.graphics.lineTo(mouseX, mouseY);

  }

  private function stopPencilTool(e:MouseEvent):void

  {

  board.removeEventListener(MouseEvent.MOUSE_MOVE, drawPencilTool);

  }

  /* Eraser Tool */

  private function EraserTool(e:MouseEvent):void

  {

  /* Quit active tool */

  quitActiveTool();

  /* Set to Active */

  active = "Eraser";

  /* Listeners */

  board.addEventListener(MouseEvent.MOUSE_DOWN, startEraserTool);

  board.addEventListener(MouseEvent.MOUSE_UP, stopEraserTool);

  /* Highlight */

  highlightTool(eraser);

  hideTools(pencil, txt);

  ct.color = 0x000000;

  shapeSize.transform.colorTransform = ct;

  }

  private function startEraserTool(e:MouseEvent):void

  {

  pencilDraw = new Shape();

  board.addChild(pencilDraw);

  pencilDraw.graphics.moveTo(mouseX, mouseY);

  pencilDraw.graphics.lineStyle(shapeSize.width, 0xFFFFFF);

  board.addEventListener(MouseEvent.MOUSE_MOVE, drawEraserTool);

  }

  private function drawEraserTool(e:MouseEvent):void

  {

  pencilDraw.graphics.lineTo(mouseX, mouseY);

  }

  function stopEraserTool(e:MouseEvent):void

  {

  board.removeEventListener(MouseEvent.MOUSE_MOVE, drawEraserTool);

  }

  /* Text Tool */

  private function TextTool(e:MouseEvent):void

  {

  /* Quit active tool */

  quitActiveTool();

  /* Set to Active */

  active = "Text";

  /* Listener */

  board.addEventListener(MouseEvent.MOUSE_UP, writeText);

  /* Highlight */

  highlightTool(txt);

  hideTools(pencil, eraser);

  }

  private function writeText(e:MouseEvent):void

  {

  var textfield = new TextField();

  textfield.type = TextFieldType.INPUT;

  textfield.autoSize = TextFieldAutoSize.LEFT;

  textfield.selectable = false;

  textfield.defaultTextFormat = textformat;

  textfield.textColor = activeColor;

  textfield.x = mouseX;

  textfield.y = mouseY;

  stage.focus = textfield;

  board.addChild(textfield);

  }

  /* Clear Tool */

  private function clearBoard(e:MouseEvent):void

  {

  /* Create a blank rectangle on top of everything but board */

  var blank:Shape = new Shape();

  blank.graphics.beginFill(0xFFFFFF);

  blank.graphics.drawRect(0, 0, board.width, board.height);

  blank.graphics.endFill();

  board.addChild(blank);

  }

  /* Default colors function */

  private function convertToBMD():void

  {

  colorsBmd = new BitmapData(colors.width,colors.height);

  colorsBmd.draw(colors);

  }

  private function chooseColor(e:MouseEvent):void

  {

  pixelValue = colorsBmd.getPixel(colors.mouseX,colors.mouseY);

  activeColor = pixelValue;//uint can be RGB!

  ct.color = activeColor;

  shapeSize.transform.colorTransform = ct;

  }

  /* Quit active function */

  private function quitActiveTool():void

  {

  switch (active)

  {

  case "Pencil" :

  board.removeEventListener(MouseEvent.MOUSE_DOWN, startPencilTool);

  board.removeEventListener(MouseEvent.MOUSE_UP, stopPencilTool);

  case "Eraser" :

  board.removeEventListener(MouseEvent.MOUSE_DOWN, startEraserTool);

  board.removeEventListener(MouseEvent.MOUSE_UP, stopEraserTool);

  case "Text" :

  board.removeEventListener(MouseEvent.MOUSE_UP, writeText);

  default :

  }

  }

  /* Highlight active Tool */

  private function highlightTool(tool:DisplayObject):void

  {

  tool.visible=true;

  }

  private function hideTools(tool1:DisplayObject, tool2:DisplayObject):void

  {

  tool1.visible=false;

  tool2.visible=false;

  }

  /* Change shape size */

  private function changeShapeSize(e:MouseEvent):void

  {

  if (shapeSize.width >= 50)

  {

  shapeSize.width = 1;

  shapeSize.height = 1;

  /* TextFormat */

  textformat.size = 16;

  }

  else

  {

  shapeSize.width += 5;

  shapeSize.height=shapeSize.width;

  /* TextFormat */

  textformat.size+=5;

  }

  }

  private function addListeners():void

  {

  pencilTool.addEventListener(MouseEvent.MOUSE_UP, PencilTool);

  eraserTool.addEventListener(MouseEvent.MOUSE_UP, EraserTool);

  textTool.addEventListener(MouseEvent.MOUSE_UP, TextTool);

  clearTool.addEventListener(MouseEvent.MOUSE_UP, clearBoard);

  colors.addEventListener(MouseEvent.MOUSE_UP, chooseColor);

  sizePanel.addEventListener(MouseEvent.MOUSE_UP, changeShapeSize);

  shapeSize.addEventListener(MouseEvent.MOUSE_UP, changeShapeSize);

  }

  }

}

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 ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

format your code so it's legible.

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
Explorer ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

Not sure I understand... Sorry!

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
Explorer ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

Like so ?

/* Drawing Application */ /* Developed by Carlos Yanez */

package {

  import PNGEncoder;

  import flash.display.MovieClip;

  import flash.display.Shape;

  import flash.display.DisplayObject;

  import flash.text.TextField;

  import flash.text.TextFormat;

  import flash.text.TextFieldType;

  import flash.text.TextFieldAutoSize;

  import flash.display.BitmapData;

  import flash.geom.ColorTransform;

  import flash.events.MouseEvent;

  import flash.events.Event;

  import flash.utils.ByteArray;

  import flash.net.FileReference;

  public class Main extends MovieClip { /* Variables */ /* Pencil Tool shape, everything drawed with this tool and eraser is stored inside board.pencilDraw */

  var pencilDraw: Shape = new Shape(); /* Text format */

  var textformat: TextFormat = new TextFormat(); /* Colors */

  var colorsBmd: BitmapData;

  var pixelValue: uint;

  var activeColor: uint = 0x000000; /* Active var, to check wich tool is active */

  var active: String; /* Shape size color */

  var ct: ColorTransform = new ColorTransform();

  public function Main(): void {

  textformat.font = "Quicksand Bold Regular";

  textformat.bold = true;

  textformat.size = 16;

  convertToBMD();

  addListeners(); /* Hide tools highlights */

  pencil.visible = false;

  hideTools(eraser, txt);

  } /* Pencil Tool */

  private function PencilTool(e: MouseEvent): void { /* Quit active tool */

  quitActiveTool(); /* Set to Active */

  active = "Pencil"; /* Listeners */

  board.addEventListener(MouseEvent.MOUSE_DOWN, startPencilTool);

  board.addEventListener(MouseEvent.MOUSE_UP, stopPencilTool); /* Highlight */

  highlightTool(pencil);

  hideTools(eraser, txt);

  ct.color = activeColor;

  shapeSize.transform.colorTransform = ct;

  }

  private function startPencilTool(e: MouseEvent): void {

  pencilDraw = new Shape();

  board.addChild(pencilDraw);

  pencilDraw.graphics.moveTo(mouseX, mouseY);

  pencilDraw.graphics.lineStyle(shapeSize.width, activeColor);

  board.addEventListener(MouseEvent.MOUSE_MOVE, drawPencilTool);

  }

  private function drawPencilTool(e: MouseEvent): void {

  pencilDraw.graphics.lineTo(mouseX, mouseY);

  }

  private function stopPencilTool(e: MouseEvent): void {

  board.removeEventListener(MouseEvent.MOUSE_MOVE, drawPencilTool);

  } /* Eraser Tool */

  private function EraserTool(e: MouseEvent): void { /* Quit active tool */

  quitActiveTool(); /* Set to Active */

  active = "Eraser"; /* Listeners */

  board.addEventListener(MouseEvent.MOUSE_DOWN, startEraserTool);

  board.addEventListener(MouseEvent.MOUSE_UP, stopEraserTool); /* Highlight */

  highlightTool(eraser);

  hideTools(pencil, txt);

  ct.color = 0x000000;

  shapeSize.transform.colorTransform = ct;

  }

  private function startEraserTool(e: MouseEvent): void {

  pencilDraw = new Shape();

  board.addChild(pencilDraw);

  pencilDraw.graphics.moveTo(mouseX, mouseY);

  pencilDraw.graphics.lineStyle(shapeSize.width, 0xFFFFFF);

  board.addEventListener(MouseEvent.MOUSE_MOVE, drawEraserTool);

  }

  private function drawEraserTool(e: MouseEvent): void {

  pencilDraw.graphics.lineTo(mouseX, mouseY);

  }

  function stopEraserTool(e: MouseEvent): void {

  board.removeEventListener(MouseEvent.MOUSE_MOVE, drawEraserTool);

  } /* Text Tool */

  private function TextTool(e: MouseEvent): void { /* Quit active tool */

  quitActiveTool(); /* Set to Active */

  active = "Text"; /* Listener */

  board.addEventListener(MouseEvent.MOUSE_UP, writeText); /* Highlight */

  highlightTool(txt);

  hideTools(pencil, eraser);

  }

  private function writeText(e: MouseEvent): void {

  var textfield = new TextField();

  textfield.type = TextFieldType.INPUT;

  textfield.autoSize = TextFieldAutoSize.LEFT;

  textfield.selectable = false;

  textfield.defaultTextFormat = textformat;

  textfield.textColor = activeColor;

  textfield.x = mouseX;

  textfield.y = mouseY;

  stage.focus = textfield;

  board.addChild(textfield);

  } /* Clear Tool */

  private function clearBoard(e: MouseEvent): void { /* Create a blank rectangle on top of everything but board */

  var blank: Shape = new Shape();

  blank.graphics.beginFill(0xFFFFFF);

  blank.graphics.drawRect(0, 0, board.width, board.height);

  blank.graphics.endFill();

  board.addChild(blank);

  } /* Default colors function */

  private function convertToBMD(): void {

  colorsBmd = new BitmapData(colors.width, colors.height);

  colorsBmd.draw(colors);

  }

  private function chooseColor(e: MouseEvent): void {

  pixelValue = colorsBmd.getPixel(colors.mouseX, colors.mouseY);

  activeColor = pixelValue; //uint can be RGB!

  ct.color = activeColor;

  shapeSize.transform.colorTransform = ct;

  } /* Quit active function */

  private function quitActiveTool(): void {

  switch (active) {

  case "Pencil":

  board.removeEventListener(MouseEvent.MOUSE_DOWN, startPencilTool);

  board.removeEventListener(MouseEvent.MOUSE_UP, stopPencilTool);

  case "Eraser":

  board.removeEventListener(MouseEvent.MOUSE_DOWN, startEraserTool);

  board.removeEventListener(MouseEvent.MOUSE_UP, stopEraserTool);

  case "Text":

  board.removeEventListener(MouseEvent.MOUSE_UP, writeText);

  default:

  }

  } /* Highlight active Tool */

  private function highlightTool(tool: DisplayObject): void {

  tool.visible = true;

  }

  private function hideTools(tool1: DisplayObject, tool2: DisplayObject): void {

  tool1.visible = false;

  tool2.visible = false;

  } /* Change shape size */

  private function changeShapeSize(e: MouseEvent): void {

  if (shapeSize.width >= 50) {

  shapeSize.width = 1;

  shapeSize.height = 1; /* TextFormat */

  textformat.size = 16;

  } else {

  shapeSize.width += 5;

  shapeSize.height = shapeSize.width; /* TextFormat */

  textformat.size += 5;

  }

  }

  private function addListeners(): void {

  pencilTool.addEventListener(MouseEvent.MOUSE_UP, PencilTool);

  eraserTool.addEventListener(MouseEvent.MOUSE_UP, EraserTool);

  textTool.addEventListener(MouseEvent.MOUSE_UP, TextTool);

  clearTool.addEventListener(MouseEvent.MOUSE_UP, clearBoard);

  colors.addEventListener(MouseEvent.MOUSE_UP, chooseColor);

  sizePanel.addEventListener(MouseEvent.MOUSE_UP, changeShapeSize);

  shapeSize.addEventListener(MouseEvent.MOUSE_UP, changeShapeSize);

  }

  }

}

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 ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

that's better but you should be indenting so it's easy to verify you have no stray curly brackets, as well as, debug and edit your code.

anyway, do you see any problem testing the code in message 5?

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
Explorer ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

Well I don't see any errors when compiling and testing in it's all by itself. I only get these errors when I copy/paste the elements in my existing .fla which is my client's App.

That's the part where I get confused. I works only when not imported in the other .FLA

Maybe I'm doing it wrong. What would be the best practice to embed that "game" in my app?

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 ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

if 'that game' is a separate swf, load it using the loader class to load it.

if you want to add a class to your project, create a separate class file and paste the code there.

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
Explorer ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

‌hi kglad,

yes yes I can create a swf with it. How would I import it so it could play on iPad?

not sure what a loader class is or how to add the class to my project.

feeling like a noob here. I just transferred from using Director lingo to learning flash in a week.

DIrector can't make 64bit iOS apps... Learning curve is kinda steep.

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 ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

var loader:Loader=new Loader();

var lc:LoaderContext = new LoaderContext(false,ApplicationDomain.currentDomain,null);

loader.load(new URLRequest('yourgameswf.swf'),lc);

addChild(loader);

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
Explorer ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

‌cool I'll try that first thing tomorrow morning!

i'll keep you posted.

wow thanks!

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 ,
Jun 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

you're welcome.

(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)

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
Explorer ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

Hi kglad,

I got it working 100%!!!! Thanks alot.

Because we are loading the SWF, is there a way to create a back button to go back to my previous scene?

I tried it with the pre-made action scripts in the scene where I load the SWF, but my button seems to be under the loader SWF.

I also tried to add it in the SWF but probably doesn't work because it can't find it...

Thanks alot!

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 ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

you can use removeChild and/or the loader's unload (or, even better, the unloadAndStop) method to display whatever the loader's content (your loaded swf) covered:

back_btn.addEventListener(MouseEvent.MOUSE_DOWN,backF);

function backF(e:MouseEvent):void{

loader.unloadAndStop();

removeChild(loader);

}

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
Explorer ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

Do I feel like a noob even more.

I selected my back symbol and pasted that code to it. I keep getting errors

Symbol 'Symbol 1', Layer 'Layer 1', Frame 1, Line 3, Column 11120: Access of undefined property loader.
Symbol 'Symbol 1', Layer 'Layer 1', Frame 1, Line 4, Column 131120: Access of undefined property loader.
Symbol 'Symbol 1', Layer 'Layer 1', Frame 1, Line 1, Column 11120: Access of undefined property back_btn.

Of course I'm doing something wrong or did not understand where to pu this.

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 ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

after selecting your back instance that's on-stage, in the properties panel add the instance name, back_btn.

that button should be on the same timeline as your loader code so when you deselect back_btn you're adding the back_btn code to the same timeline that has the loader code.

click an empty part of the stage or the back stage to deselect everything, and in the actions panel add the back_btn code.

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
Explorer ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

Did exactly that but getting this error :

Scene 1, Layer 'Actions', Frame 1, Line 3, Column 11120: Access of undefined property loader.
Scene 1, Layer 'Actions', Frame 1, Line 4, Column 131120: Access of undefined property loader.

This is my code :

back_btn.addEventListener(MouseEvent.MOUSE_DOWN,backF);

function backF(e:MouseEvent):void{

loader.unloadAndStop();

removeChild(loader);

}

Thanks for your great help and patience!

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 ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

where's the loader code?

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
Explorer ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

it's in my scene called : Henri in my main .fla

I pasted that code in the swf of the drawing.

I Think I'm not doing it right.....

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
Explorer ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

Okay here is what I just tried.

The load script is in my scene Henri in my main Flash file

In that scene I have a back buton (now called back_btn)

The script is pasted in the actions as told.

it loads up the SWF (which works great).

No errors done that way but, I think the SWF loads itself in front of my back button.

That's the reason why I tried to load the back button script in the Drawing SWF file.

Hope I'm clear...

I then tried to manage it all with layers. But the SWF still loads itself in front of my Back button.

Any suggestions?

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 ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

the loader code must be in the same scope was the back button code.

it might be easier for you to put the backF() code in the same frame as the loader code.  you then need to use the correct path to that function from the back_btn listener code.

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 ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

execute a

addChild(back_btn);

any time after

addChild(loader);

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
Explorer ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

I also added a removeChild(back_btn);

after the removeChild(loader);

so that the button removes itself, so that my back button in my scene works.

One thing I noticed is that if I return to the drawing portion. It doesn't load anymore. but the back_btn is there.

Is there a way to force reset that scene?

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
Explorer ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

Can it be the loader.unloadAndStop();

Can I unload it and go to a specific scene?

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