|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
loading jpg
I'm trying to load a jpg into a movie clip that I have in my frame. I know that you can't resize the picture until its been loaded so I tried to use the following code:
picholder_mc.onLoad = function(){ this._height *= 250/this._height; this._width *= 250/this._height; } picholder_mc.loadmovie("room.jpg"); It seems that the onLoad function doesn't work for loading jpg's. So I can't figure out how I'll know when the picture is loaded. Any ideas? Thanks. |
|
#2
|
|||
|
|||
|
hey,
what you'll have to do is cue an onEnterFrame event once you start loading, doing a test on the getBytesLoaded... once the getBytesLoaded() is greater than the getBytesTotal() for your instance, resize and kill the onEnterFrame event... it seems to be the only work around... let me know if you need code cheers, bret |
|
#3
|
|||
|
|||
|
I thought I understood, but my code isn't working. Here's what I have:
picholder_mc.onEnterFrame = function(){ trace("here"); } picholder_mc.loadmovie("Waterlilies.jpg"); I thought this would trace "here" over and over again, but its not tracing anything. thanks bret. |
|
#4
|
|||
|
|||
|
hmmm... well here's a work around... same concept, just a little different application.
cheers, bret |
|
#5
|
|||
|
|||
|
Thanks Bret. I'm still not sure why my version didn't work, but yours did. Here's what I have:
************ _root.createEmptyMovieClip("placeholder_mc",1); placeholder_mc.createEmptyMovieClip("pic_mc", 2); placeholder_mc.pic_mc.loadMovie("girl51.jpg"); placeholder_mc.onEnterFrame = resize; ******* That works fine. Now I'm trying to display files whose names are loaded from a SQL database. It seems like this code should work, but it doesn't: *************** var data = new loadvars(); data.onload = function(){ current = 0; if(this.n > 0){ _root.createEmptyMovieClip("placeholder_mc",1); _root.placeholder_mc.createEmptyMovieClip("pic_mc", 2); _root.placeholder_mc.pic_mc.loadMovie("images/"+this.filename0); _root.placeholder_mc.onEnterFrame = resize; author_txt.text = "images/"+this.filename0; } } data.load("display.php"); ***************** Now its not resizing the photo. Its not recognizing the onEnterFrame call. Any more ideas? thanks. |
|
#6
|
|||
|
|||
|
so do you mean that it's not even calling the onEnterFrame function at all? (have you tried tracing something in that function to see if it's getting called...) Does the pic load in but not resize? Are you sure that all of your variables from your php script are loading correctly?
here's a thread concerning your exact same issue.. the second to last post has a solution if you cant get this version working (it's the same concept, just uses setInterval instead of an enterFrame event.) http://friendsofed.infopop.net/2/Op...65&m=2263091586 cheers, bret |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > loading jpg |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|