Im having problems when loading a movieClip into an empty container, I can’t access the onRelease event. For example:
t1.onRelease = function() {
currentPic ='products/pro/mainImage.jpg';
cMC.loadPic(currentPic);
};
MovieClip.prototype.loadPic = function(pic) {
this.loadMovie(pic);
**//not working**
** this.onRelease = function(){
this.unloadMovie(pic);
}**
}
Any ideas??
Thanks
Daniel
rollwithit80:
Im having problems when loading a movieClip into an empty container, I can’t access the onRelease event. For example:
t1.onRelease = function() {
currentPic ='products/pro/mainImage.jpg';
cMC.loadPic(currentPic);
};
MovieClip.prototype.loadPic = function(pic) {
this.loadMovie(pic);
**//not working**
** this.onRelease = function(){
this.unloadMovie(pic);
}**
}
Any ideas??
Thanks
Daniel
so you just can’t get the onRelease to work? because if its in another contrainer you scope is wrong you would need containName.mc.onRelease=function()
You cannot assign onRelease functions to a clip you just loaded. The load command, which is **not **necessarily performed immediatley after the loadMovie() method is invoked, rewrites all methods and properties of the clip receiving the load. So a work around is something like
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onEnterFrame[/COLOR] = [COLOR=#000000]**function**[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onRelease[/COLOR] = [COLOR=#000000]function [/COLOR] COLOR=#000000 [/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#808080]// do stuff [/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#0000FF]delete[/COLOR] [COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onEnterFrame[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]
Hi, I have attached a sample of what i am trying to acheive. So when you click on the main image it hides it, but the onRelease event still not working.
Thanks;)
been on it all day, its doing my head in… should be basic huh??
ahhhh:krazy: :krazy:
scotty
March 30, 2006, 6:54am
6
t1.onRelease = function() {
currentPic = 'products/pro/mainImage.jpg';
cMC.loadPic(currentPic);
};
MovieClip.prototype.loadPic = function(pic) {
this.loadMovie(pic);
var clip = this;
var temp = this._parent.createEmptyMovieClip("temp", 9978);
temp.onEnterFrame = function() {
if (clip._width) {
clip.onRelease = function() {
this.unloadMovie();
};
delete this.onEnterFrame;
}
};
};
scotty(-:
thanks a million, i think i was going the wrong way about it. Works smooth…
You are the king…:king: :king: