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 Costa
Sr. Product Manager
Macromedia
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Elst
Sent: Wednesday, October 19, 2005 3:29 AM
To: [email protected]
Subject: [flexcoders] custom effect in Flex Builder 2
I was experimenting with a custom effect for Flex and am having some problems porting it to Flex Builder 2. First thing I did was add a class package, if I leave the package empty it gives me a "base class not found" error so I put it in com.peterelst.
I changed the xmlns in the MXML Application tag to read com.peterelst and the error I get now is "cannot resolve <Rotate> to a component name". Is there a problem with the class, does it just need some extra lines or metadata to be recognized by Flex Builder? I'm not yet fully up to speed with AS3 or custom effects in Flex so please bear with me ;)
Thanks for any pointers!
Peter
Rotate.as (in /com/peterelst/)
package com.peterelst {
class Rotate extends mx.effects.TweenEffect {
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;
}
}
}
RotateEffect.mxml
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="com.peterelst">
<mx:Effect>
<Rotate name="myRotateEffect" rotateBy="360" duration="1000" />
</mx:Effect>
<mx:Image id="myAnimation" source="@Embed('http://www.macromedia.com/images/homepage/promos/flash_platform.jpg')" mouseDownEffect="myRotateEffect" />
</mx:Application>
--
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.

