Is this even possible, bitmap not being an interactiveObject and all?

In your first post you said:
"Whenever I issue a command "addChild(bitmap)" the new image is being merged
with the existing one."
I guess the images are just stacked on top of eachother here where the last
bitmap loaded loads on top of the older one.

In your script below you add 2 bitmaps to a Sprite and want to use mouse
stuff on the bitmap, I guess that that won't work because they are not of
type interactiveObject.... I guess that creating a sprite, add the bitmap to
the sprite, add the listeners to the sprite, and add the sprite to the
displaylist of your class(sprite)should work.


-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Petro Bochan
Verzonden: woensdag 20 december 2006 12:52
Aan: Flashcoders mailing list
Onderwerp: RE: [Flashcoders] AS3.0 - add separate objects to stage

James Tann
> Are you sure about this? I have been using bitmaps extensively in the 
> project im working on and have had no issues like this. What is the 
> structure of children like?
> 
> Sprite ->
>        -> Bitmap
>        -> Bitmap
> 
> I would have to see some code to help out.
> Jim

Hi James,

This is not the pure example code from the project but this kind of
resembles the idea.

----------------
package {
        import flash.display.Sprite;
        import flash.display.Loader;
        import flash.net.URLRequest;
        import flash.events.Event;
        import flash.events.IOErrorEvent;
        import flash.display.Bitmap;
        import flash.events.MouseEvent;
        import flash.utils.Timer;
        import flash.events.TimerEvent;
        import flash.display.BitmapData;

        public class addChildIssue extends Sprite
        {
                public function addChildIssue()
                {
                        var timer:Timer = new Timer(5000);
                        timer.addEventListener(TimerEvent.TIMER,
onTimer);
                        timer.start();
                        var uploader:Loader = new Loader();
                        var url:URLRequest = new URLRequest();
                        url.url =
"http://www.venturaes.com/macromedia/images/studio8_box.jpg";;
        
uploader.contentLoaderInfo.addEventListener(Event.COMPLETE, onResult);
        
uploader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,
onFault);
                        uploader.load(url);
                }
                
                private function onResult(anEvent:Event):void
                {
                        var bitmap:Bitmap =
Bitmap(anEvent.target.content);
                        bitmap.addEventListener(MouseEvent.MOUSE_DOWN,
onDrag);
                        bitmap.addEventListener(MouseEvent.MOUSE_UP,
onDrop);
                        addChild(bitmap);
                }
                
                private function onFault(anEvent:Event):void
                {
                        
                }
                
                private function onDrag(anEvent:MouseEvent):void
                {
                        anEvent.target.startDrag();
                }
                
                private function onDrop(anEvent:MouseEvent):void
                {
                        anEvent.target.stopDrag();
                }
                
                private function onTimer(anEvent:TimerEvent):void
                {
                        var uploader:Loader = new Loader();
                        var url:URLRequest = new URLRequest();
                        url.url =
"http://wwwimages.adobe.com/www.adobe.com/products/audition/images/audit
ion_flash.jpg";
        
uploader.contentLoaderInfo.addEventListener(Event.COMPLETE, onResult);
        
uploader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,
onFault);
                        uploader.load(url);
                }

        }
}
----------------------

Copy and past it into Flex, should work. I even now face the problem of not
being able to move any image at all. This works fine with shapes, but
bitmaps fail.

Thanks,
Petro

_______________________________________________
[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