Hi,
-
You need import the class your
subclassing.
- Effects API has changed a little,
there are some changes in method
signatures.
- You need override keyword while overriding a method
in subclass.
- _rotation is changed to
rotation
- You need to surrounding <mx:Effects> tag
anymore
- name attribute of effects has been deprecated and
instead "id" attribute is recommended.
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="com.peterelst.*">
<Rotate id="myRotateEffect" rotateBy="1000" duration="1000" />
<mx:Image id="myAnimation" source="@Embed('flash_platform.jpg')" mouseDownEffect="myRotateEffect" />
</mx:Application>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="com.peterelst.*">
<Rotate id="myRotateEffect" rotateBy="1000" duration="1000" />
<mx:Image id="myAnimation" source="@Embed('flash_platform.jpg')" mouseDownEffect="myRotateEffect" />
</mx:Application>
Untested code:
package
com.peterelst {
import mx.effects.*;
import mx.effects.*;
public class Rotate extends mx.effects.TweenEffect {
var target:Object;
var rotateBy:Number;
var rotateTween:mx.effects.Tween;
function Rotate(targetObj:Object) {
target = targetObj;
}
override public function playEffect(targets:Array = null):Array
{
rotateTween = new mx.effects.Tween(this, target._rotation,
target._rotation+rotateBy, duration);
}
function onTweenUpdate(tweenValue):Void {
target._rotation = tweenValue;
}
}
}
rotateTween = new mx.effects.Tween(this, target._rotation,
target._rotation+rotateBy, duration);
}
function onTweenUpdate(tweenValue):Void {
target._rotation = tweenValue;
}
}
}
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Elst
Sent: Thursday, October 20, 2005 1:19 AM
To: [email protected]
Subject: Re: [flexcoders] custom effect in Flex Builder 2
The strange thing is that if I do an import of mx.effects.* first and extend TweenEffect it doesn't give that base class error but "conflict with inherited definition target in namespace public" for the target property and "incompatible override" and "overriding function that is not marked for override" for the playEffect method.
testEffect.mxml
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="com.peterelst.*">
<mx:Effect>
<Rotate name="myRotateEffect" rotateBy="1000" duration="1000" />
</mx:Effect>
<mx:Image id="myAnimation" source="@Embed('flash_platform.jpg')" mouseDownEffect="myRotateEffect" />
</mx:Application>
Rotate.as
package com.peterelst {
public class Rotate extends mx.effects.TweenEffect {
var target:Object;
var rotateBy:Number;
var rotateTween:mx.effects.Tween;
function Rotate(targetObj:Object) {
target = targetObj;
}
function playEffect():Void {
rotateTween = new mx.effects.Tween(this, target._rotation,
target._rotation+rotateBy, duration);
}
function onTweenUpdate(tweenValue):Void {
target._rotation = tweenValue;
}
}
}
On 10/19/05, Philip
Costa <[EMAIL PROTECTED]> wrote:
You have to mark your class public.The default in AS3 is private, so that's why your MXML page can't see it.Phil CostaSr. Product ManagerMacromedia
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

