-
hey everyone,
basically, i want to change a few properties, such as position and size of my dynamically loaded jpg. but supposodly i cant change these properties unless the jpg is fully loaded, this makes sense.
i have a blank movie clip called 'forGpic' (for gallery pic) and i do a loadMovie("pic/pic1.jpg",forGpic);
now, that works fine, but if i try and do a forGpic._width = 10; or something like that, it wont work.
how do i check and wait for the jpg to load? maybe is there another way that i should load the jpg? or a on(success) or something?
i did a trace(forGpic.getBytesLoaded+" of "+forGpic.getTotalBytes) and in my output window i get the perfect output, but how would i write the code after the loadMovie function so that it keeps cheking the the bytes loaded == total bytes until they equal and then it sets my properties?
any replys are greatly appreciated. thanks in advance.
-
Place an onData event handler into the forGpic MC
onData = function()
{
//place all your changes that you want done to the MC here
forGpic._width = 10;
}
-
-
MX also supports this in MCs look
you can find this in the MX local referance:
myMovieClip.onData = function () {
trace ("onData called");
};
-
well, ill have to try this when i get home. i hope that works, it will solve many of my problems haha. thank you for the help.
-
well, it doesnt seem to work, it just adds the picture like its supposed to, without changing the alpha property. here is my code:
Code:
function forGallery(param){
argumentArray = new Array;
argumentArray = param.split(",");
loadMovie("pics/"+argumentArray[0]+"/"+argumentArray[1]+".jpg", forGpic);
forGpic.onData = function(){
forGpic._alpha = 70;
}
}
i call the function through an asfunction url link from my text box.. that works i know cause the picture does show up, my alpha effect just doesnt happen.
any ideas? Thanks in advance.
-
If you add an "on" function using ActionScript to forGpic before loadMovie, then it seems to be wiped out by loadMovie. Presumably as you are replacing the MC it replaces functions as well.
Code:
this.attachMovie("PictureHolder", "Pic1", 1); // using library linkage
Pic1.onRollOver = function() {
trace("hello");
}; // this works if you don't do the next line
loadMovie("c:/temp/cat22.jpg", Pic1);
// after this, the onRollOver doesn't work
But, it works fine if you simply use the onClipEvent (Data) inside the forGpic MC:
Code:
onClipEvent (data) {
this._alpha = 78;
}
but I don't understand why I can't make it work when you set the event function programmatically.
-
oh jeeze... actually, i think i screwed up... that function is supposed to go on the movieclip isnt it?? maybe ill try moving the function there instead of my actions layer... = / sorry.. if that doesnt work ill try a this.onData and then the onMovieClip(data). thanks... ill post later today.
-
excellent!!! here is my code... it works great... thanks everyone:
Code:
onClipEvent(data){
this._alpha = 70;
this._width = 384;
this._height = 288;
}
i had also posted in a thread about corrupted jpgs in my movie... seems liek they arent corrupted anymore.. haha.. well, im pretty happy, yet again FlashKit is the best community. thanks again!
-
you can use a similar code as a webcam viewer
i posted it b4 here
http://board.flashkit.com/board/show...hreadid=301557