You have to wait for your image to load before you can change the width and height. your Loader instance has a contentLoaderInfo property that is an instance of the LoaderInfo class. The LoaderInfo instance will dispatch the Event.INIT event when your Loader instance is ready to be manipulated. You can listener for the event like this:

backLoader.contentLoaderInfo.addEventListener(Event.INIT, resizeImage);

and then you would have to add a new method to your class called resizeImage (or whatever you want to call it as long as it matches the name in the addEventListener argument):

public function resizeImage():void {
    backLoader.width = 100; // or whatever your new width is
    backLoader.height = 100; // or whatever your new height is
}

- juan

On Jun 15, 2007, at 10:46 AM, Gustavo Duenas wrote:

Thanks Juan, look I changed as you told me but it seems that the image is huge as it should be, how ca I resize it, I've tried using .width and heightr but then nothing...some ideas, this is the new code:

package {
        import flash.display.Sprite;
        import flash.display.*;
        import flash.events.*;
        import flash.accessibility.*;
        import com.adobe.viewsource.ViewSource;
        import flash.net.*;
    import flash.geom.*;
    import flash.text.*;
    import flash.net.URLRequest;
    import flash.net.*;
        
        
        

        public class template1 extends Sprite
        {
                public function template1()
                {
                        //inserting movieClip as background;
                        var backLoader:Loader = new Loader();
backLoader.load(new URLRequest("http://leftandrightsolutions.com/ backy1.jpg"));
        
                        backLoader.x=-200;
                        backLoader.y=0;
                                
                        addChild(backLoader);
                        
                                
                        }
                
                        
                }
        }
}


regards


gustavo



On Jun 15, 2007, at 12:54 PM, Juan Carlos Anorga wrote:

Hi Gustavo,

the load method takes a URLRequest instance, not a String. So change:

backLoader.load("http://leftandrightsolutions.com/backy1.jpg";);

to:

backLoader.load(new URLRequest("http://leftandrightsolutions.com/ backy1.jpg"));

- juan

On Jun 15, 2007, at 9:34 AM, Gustavo Duenas wrote:

Ok coder this is my first flash as3 project in flex, I'm just trying to do something simple.
But I have an 1067 error that says:


1067: Implicit coercion of a value of type String to an unrelated type flash.net:URLRequest. template1 template1.as line 22



package {
        import flash.display.Sprite;
        import flash.display.*;
        import flash.events.*;
        import flash.accessibility.*;
        import com.adobe.viewsource.ViewSource;
        import flash.net.*;
    import flash.geom.*;
    import flash.text.*;
    import flash.net.URLRequest;
    import flash.net.*;
        
        
        

        public class template1 extends Sprite
        {
                public function template1()
                {
                        //inserting image as background;
                        var backLoader:Loader = new Loader();
                        
backLoader.load("http://leftandrightsolutions.com/backy1.jpg";);
                        addChild(backLoader);
                        
                }
        }
}


I have to admit I'm the newbiest in this as3 project thing....help.


Gustavo Duenas
Creative Director
LEFT AND RIGHT SOLUTIONS LLC
1225 W. Beaver St. Suite 119
Jacksonville, Fl.  32204
904 . 2650330
www.leftandrightsolutions.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


Gustavo Duenas
Creative Director
LEFT AND RIGHT SOLUTIONS LLC
1225 W. Beaver St. Suite 119
Jacksonville, Fl.  32204
904 . 2650330
www.leftandrightsolutions.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

Reply via email to