Skip to main content
Inspiring
September 15, 2013
Question

Load External image

  • September 15, 2013
  • 1 reply
  • 1391 views

I'm  trying to load an image for a Photos folder. The photo.swf is in the same file structor as the "photos "folder, using the code below is works great when I open photo.swf and then click the P_002 button. All of this in contained in a folder named "content"

P_002.onPress = function():Void {

loadMovie("photos/002.jpg", _root.photo.empty);

The problem is I have a main menu swf file outside the "Content" folder When I launch the photo.swf form the main menu it will not load the photo.

I have tried moving the photos folder several places but no help

I also tried adding content to the path

P_002.onPress = function():Void {

loadMovie("content/photos/002.jpg", _root.photo.empty);

Can someone please help solve this?

wayne

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
September 15, 2013

Where is _root.photo,empty?  If you are loading the photo swf into the main menu swf then the _root may no longer be where you thought it was.  You might need to use _lockroot foir the photo swf so that when it makes _root references it is still looking at its own _root and not that of some _parent swf.

489175Author
Inspiring
September 15, 2013

I'm still new to AS. the lockroot makes sense

The _root is in the photo.swf not the main menu

How do I add that in the path I already have

P_002.onPress = function():Void {

loadMovie("photos/002.jpg", _root.photo.empty);

Ned Murphy
Legend
September 15, 2013

Just try adding the following line before the lines in photo.swf that you showed:

this._lockroot = true;

You might still have an issue with properly targeting loading the files if photo is loaded within some other swf, so you might need to juggle the path a little more, but with the line of code I just showed photo will be targeting its own _root