Thanks to all, this is the final cide, that really works for me.
stop();
var models = new Array();
models = [ "model1", "model2", "model3", "model4"];
trace(models.length);
for (i=0; i<models.length; i++){
movieName=models[i];
var newMC= this.container1.createEmptyMovieClip
(movieName,this.container1.getNextHighestDepth());
var img_mc = newMC.createEmptyMovieClip("img_mc"+i, 1);
// load your image
img_mc.loadMovie("models/"+movieName+".jpg");
newMC._x=100*-i;
newMC._y=100*i;
trace (img_mc);
newMC.onEnterFrame = function() {
var bl = img_mc.getBytesLoaded();
var bt = img_mc.getBytesTotal();
if(bl == bt && bt > 0) {
delete this.onEnterFrame;
this.onPress= function(){
trace("bene");
this.startDrag(true);
}
this.onRollOver=function(){
this.stopDrag();
}
}
}
}
Regards
Gustavo Duenas
On Apr 6, 2007, at 6:14 PM, Gustavo Duenas wrote:
thanks for all guys I'm gonna run the codes to see which one fits
me better.
Regards
Gustavo Duenas
Ps: I'm using AS2
On Apr 6, 2007, at 5:45 PM, Muzak wrote:
I don't know what's going on with the list (and the kind of
replies) lately.
Quick hacks are just what they are, quick hacks.. avoid them..
As David pointed out, dump and forget about loadMovie (there's no
loadMovie in AS3 anyways).
Use the MovieClipLoader class to load external assets (replaced
with flash.display.Loader in AS3)
It's much more elegant and has methods and events to handle
loading of external assets.
As for the reason why your events attached to the movieclip don't
work, that's because when loading something in a MovieClip,
everything associated with that MovieClip is cleared/removed.
So you'll have to wait for the external asset to be fully loaded
before assigning events to the MovieClip and that's what the
MovieClipLoader is for. The onLoadInit event will tell you when
the MovieClip is ready to work with and is when you can assign
events to it.
regards,
Muzak.
----- Original Message -----
From: "David Ngo" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, April 06, 2007 9:30 PM
Subject: RE: [Flashcoders] attaching an event to a movie clip
Personally, I find onEnterFrames bad practice to use unless you
absolutely
have to (if your logic is frame-based, etc). I would suggest the
nested clip
and/or use MovieClipLoader to handle your image loading.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com