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