I need to create a flash file that creates shape patterns from just one image. It should reflect or mirror the loaded drag-and-drop movie clip - with updating the reflection / mirror when moving and dragging the movie clip around the scene.
I came across: http://active.tutsplus.com/freebies/actionscript-30-classes/dynamic-reflection-generator-class-for-as3/
which is very similar to what I later. The demo looks fine, but as in the comments, there is a lot of slowdown and lag when dragging, especially when the image you are dragging starts larger.
Sorry for asking that it seems quite a bit, I'm not after a complete decision, I just need to know if this can be done, and how can I do it?
I hope the following images help explain:
Step 1:
Upload the user template image to the scene, as shown here:
http://www.tiltworld.co.uk/yhfus6fh/pattern_1.png
Stage 2:
Shows how I want the reflection to work - 4 blocks on each side of the template:
... / pattern_2.png
(same link as above, only with pattern_2.png at the end)
Stage 3:
Getting reflection to adapt to where the user drags the template around on the stage. As in the image, reflection occurs within 4 blocks on each side, and does not attach directly to / next to the original movie clip.
.... / pattern_3.png
( , , _3.png )
:)
p.s. 1 - , fileReference.load, startDrag, .
var draggableMC:FileReference;
var draggable_mc_loader:Loader = new Loader();
var draggable_mc_content:Sprite = new Sprite();
select_btn.addEventListener(MouseEvent.CLICK, onselect_btnClicked);
function onselect_btnClicked(event:MouseEvent):void {
draggableMC=new FileReference();
draggableMC.addEventListener(Event.SELECT, onFileSelected);
var imageTypeFilter:FileFilter = new FileFilter("JPG/PNG Files","*.jpeg; *.jpg;*.gif;*.png");
draggableMC.browse([imageTypeFilter]);
}
function onFileSelected(event:Event):void {
draggableMC.addEventListener(Event.COMPLETE, onFileLoaded);
draggableMC.load();
}
function onFileLoaded(event:Event):void {
var fileReference:FileReference=event.target as FileReference;
var data:ByteArray=fileReference["data"];
var movieClipLoader:Loader=new Loader();
movieClipLoader.loadBytes(data);
movieClipLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onMovieClipLoaderComplete);
draggableMC.removeEventListener(Event.COMPLETE, onFileLoaded);
}
function onMovieClipLoaderComplete(event:Event):void {
var loadedContent:DisplayObject=event.target.content;
draggable_mc_loader =event.target.loader as Loader;
draggable_mc_loader.x=10;
draggable_mc_loader.y=10;
draggable_mc_content.buttonMode=true;
draggable_mc_content.addChild(draggable_mc_loader);
addChild(draggable_mc_content);
}
draggable_mc_content.addEventListener(MouseEvent.MOUSE_DOWN, drag);
stage.addEventListener(MouseEvent.MOUSE_UP, drop);
function drag(event:Event):void {
draggable_mc_content.startDrag();
}
function drop(event:Event):void {
draggable_mc_content.stopDrag();
}