Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onClipEvent(data) or onData does not work all the way...

Status
Not open for further replies.

SamG1000

Programmer
Nov 17, 2002
11
US
I am trying to load a jpeg or swf file into a movie clip (Pic) on my stage.

_root.cont.Pic & root.cont.fail - "Pic" for Movie Clip that I load a jpeg/swf file into, "fail" to show that the movie has loaded/failed to load

On the movieclip code i have:
Code:
  onClipEvent(data) {
    trace(this);
    trace(_parent);
    _parent.fail._visible = false;
  }
When I load a swf file, this code works once onClipEvent(data) is called, but when I load a jpeg file: 1. debugging does not work, 2. "this" command works but "_parent" and everything else is undefined...

when I define (code located in: _root.cont)
Code:
Pic.onData = function () {
    trace(Pic);
    trace(this);
    trace(_parent);
    _parent.fail._visible = false;
}
Once I load anything into Pic - that code is no functioning (at all)

Is there any way that i can check the result of the loadMovie without using onClipEvent(data), onData

How should I correctly use onClipEvent(data) or onData so it works?

.fla files would be really helpful!
I appreciate any suggestions...

Sincerely,
Simon
 
This woll load the pic and centre it in the movie. just alter the code to place the jpeg where you want it

intAvailableWidth = 800;
intAvailableHeight = 600;

This is where you can define the size of your flash movie so that the actionscript in 'Step 3' can determine where to place the dynamic jpeg that is loaded so it is centered in your movie.

Create a movie clip on the workspace and name it 'mcDynamicImage'.

Right click the new movieclip and give it the following actions:

onClipEvent(data){
_root.mcDynamicImage._x = (_root.intAvailableWidth - this._width) / 2;
_root.mcDynamicImage._y = (_root.intAvailableHeight - this._height) / 2;
}
loadMovie("image.jpg","_root.mcDynamicImage");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top