PDA

View Full Version : Drag and FadeOut


Chelsea
10-10-2008, 02:53 PM
Hi,
I have an object that I want user to drag into a fire. When the user releases the mouse I want the object to fade out so it appears it was consumed by the fire. This is the code I have so far:


on(rollOver)
{
Mouse.show(hand);
}

on(press) {
startDrag(this);
}
//this line releases the shape and shows the mouse again on the screen
//this is where I want to add the code for the object to fade out and dissappear

on(release) {
stopDrag();
Mouse.show();


Any help with the code for the object to fade out would help. Thanks.

raydowe
10-10-2008, 10:20 PM
import fl.transitions.Tween;
import fl.transitions.easing.*;

var myTween:Tween;

// when you want to use it, say...
myTween = new Tween(targetclip_mc, "alpha", None.easeNone, 1, 0, 1, true);

// reads (display object to affect, target property to change in quotes, tween method to implement, start value, end value, duration, seconds = true/frames = false)


Make sure you declare the tween variable outside of all functions. If it's inside a function that ends before the tween is finished, it can act unexpectedly and end prematurely.

elaboratebong
10-15-2008, 04:22 AM
The above user told you HOW to transition the image yet, left out the important code to tell the fire to burn whatever it is that you ar burning

here is what you should use, paste it onto your object you desire to burn.

import fl.transitions.Tween;
import fl.transitions.easing.*;

var myTween:Tween;

onClipEvent (enterFrame) {
if (this, hitTest(/*the root of your fire*/)) {
myTween = new Tween(targetclip_mc, "alpha", None.easeNone, 1, 0, 1, true);

}
}

Hope this helps :cool: