-
F8]-image resizing
I have been working on a website for my art and already have one up. However, I am not that great at Flash so my first website loads some what slow.
What I have been working on recently is have a website where all the images are loaded externally.
I have achived this however, what I would like to do is have my images resize to a certain area and be larger than they are.
Can someone please guide me in the right direction?
My site is www.moonartdesign.com/~m2
Here is some of my code
stop();
loadingBar._xscale = 1;
var loadingCall:Number = setInterval(preloadSite, 50);
function preloadSite():Void {
var siteLoaded:Number = _root.getBytesLoaded();
var siteTotal:Number = _root.getBytesTotal();
var percentage:Number = Math.round(siteLoaded/siteTotal*100);
loadingBar._xscale = percentage;
percentClip.percentDisplay.text = percentage + "%";
percentClip._x = loadingBar._x + loadingBar._width;
bytesDisplay.text = "loaded " + siteLoaded + " of " + siteTotal + " bytes";
if (siteLoaded >= siteTotal) {
clearInterval(loadingCall);
gotoAndStop(2);
}
}
midnight_btn.onRelease = function(){
_root.createEmptyMovieClip("target_mc",1);
loadMovie("Midnight_Woman_FOR_SALE_$55.jpg",_root. target_mc);
scaleRatio=20;
container_mc._xscale=scaleRatio;
container_mc._yscale=scaleRatio;
}
rem_btn.onRelease = function(){
_root.createEmptyMovieClip("target_mc",1);
loadMovie("Remeber_02.jpg",_root.target_mc);
}
//and this is the very end of my code
target_mc._x = Stage.width/2 - target_mc._width/2;
target_mc._y = Stage.height/2 - target_mc._height/2;
target_mc._visible = true;
:: Everything works except for my images resizing.
I have been searching through several forums and tutorials and I have no idea what I am doing wrong.
I am also having an issue with the preloader for each image...Do I place the preloader over the holder?
Or within the code for each button?
Any help would be great.
Thanks in advance.
M>A>D
-
Senior Member
- The right of the People to create Flash movies shall not be infringed. -
-
Originally Posted by cancerinform
Cancerinform-
I first would like to say thank you for your guidance and I appreciate you passing along your wisdom.
That being said I am confused about the thread you have shown me.
I tried using what you had written but nothing was affected.
I noticed that above the code it had said PHP. Do I have to use this externally (outside of my .swf) and draw from this?
I look forward to your reply.
-
Senior Member
You only need the code within the php tags. You have to modify it for your purpose regarding variables. What it does is to dispatch an event when the image is loaded. Loading takes much longer than executing the script. That is why the images are not resized.
- The right of the People to create Flash movies shall not be infringed. -
-
Originally Posted by cancerinform
You only need the code within the php tags. You have to modify it for your purpose regarding variables. What it does is to dispatch an event when the image is loaded. Loading takes much longer than executing the script. That is why the images are not resized.
Allright, I think I am moving in the right direction however, I still don't know what I am doing wrong.
I have done some research into this issue and this is the code I have come up with that doesn't seem to be working:
stop();
import mx.utils.Delegate;
var holder:MovieClip = this.createEmptyMovieClip("holder",this.getNextHig hestDepth());
holder.loadMovie (image_path);
var myListener:Object = new Object ();
myListener.resize = function (evObj:Object)
{
if(holder.getBytesTotal()>0)
{
holder._width = Stage.width;
holder._height = Stage.height;
}
};
var myDispatch:Function = new CreateDispatcher ();
myDispatch.addEventListener ('resize', myListener);
function CreateDispatcher ()
{
EventDispatcher.initialize (this);
scaleRatio = setInterval (Delegate.create (this, dispEvent), 20);
}
function dispEvent ():Void
{
clearInterval (scaleRatio);
this.dispatchEvent ({type:'resize'});
}
If you could let me know what I am doing wrong that would appreciated.
Hope to hear from you.
MAD
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|