4 Replies Latest reply on Aug 25, 2010 12:25 PM by existnresist

    TextAnim - i need a running example. and please hurry :)

    existnresist

      hi y'all,

       

      i urgently need help with something which should be very straightforward:

      i am unable to use TextAnim - no matter what. could anyone please send me a complete source code of a running example?

      whatever i do - i run into an exception or a compile error. (for example - addChild cannot be used in SDK4.0 but i cannot use something else with the TextField component).

       

      some TextAnim tutorial:

      http://www.actionscript.org/forums/showthread.php3?t=226682

      and the project website:

      http://code.google.com/p/textanim/

       

      so please send a running source code. much appreciated! 

       

      thanks,

      ronnie

        • 1. Re: TextAnim - i need a running example. and please hurry :)
          existnresist Level 1

          forgot to mention:

          am running Flash Builder 4.

           

          thanks

          • 2. Re: TextAnim - i need a running example. and please hurry :)
            Boy Carper Level 1

            You can use a SpriteVisualElement to add Sprites

            • 3. Re: TextAnim - i need a running example. and please hurry :)
              existnresist Level 1

              thanks for the reply but am still clueless. current exception:

              TypeError: Error #1034: Type Coercion failed: cannot convert flash.text::TextField@3f430b1 to mx.core.IUIComponent.

                   at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()[C:\autobuild\3.5.0\frameworks\pr ojects\framework\src\mx\core\Container.as:3302]

                   at mx.core::Container/addChildAt()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\c ore\Container.as:2250]

                   at mx.core::Container/addChild()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\cor e\Container.as:2183]

                   at nili_homepage_animated/application1_initializeHandler()[C:\Users\Ronnie\Adobe Flash Builder 4\nili_homepage_animated\src\nili_homepage_animated.mxml:37]

                   at nili_homepage_animated/___nili_homepage_animated_Application1_initialize()[C:\Users\Ronni e\Adobe Flash Builder 4\nili_homepage_animated\src\nili_homepage_animated.mxml:6]

                   at flash.events::EventDispatcher/dispatchEventFunction()

                   at flash.events::EventDispatcher/dispatchEvent()

                   at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9440]

                   at mx.core::UIComponent/set processedDescriptors()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UICom ponent.as:1216]

                   at mx.core::Container/createComponentsFromDescriptors()[C:\autobuild\3.5.0\frameworks\projec ts\framework\src\mx\core\Container.as:3549]

                   at mx.core::Container/createChildren()[C:\autobuild\3.5.0\frameworks\projects\framework\src\ mx\core\Container.as:2632]

                   at mx.core::UIComponent/initialize()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx \core\UIComponent.as:5381]

                   at mx.core::Container/initialize()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\c ore\Container.as:2569]

                   at mx.core::Application/initialize()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx \core\Application.as:864]

                   at nili_homepage_animated/initialize()[C:\Users\Ronnie\Adobe Flash Builder 4\nili_homepage_animated\src\nili_homepage_animated.mxml:0]

                   at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.5.0\frameworks\pro jects\framework\src\mx\managers\SystemManager.as:2131]

                   at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\3.5.0\frameworks\proje cts\framework\src\mx\managers\SystemManager.as:3400]

                   at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\autobuild\3.5.0\framework s\projects\framework\src\mx\managers\SystemManager.as:3223]

                   at mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.5.0\frameworks\projects\fram ework\src\mx\managers\SystemManager.as:3069]

              • 4. Re: TextAnim - i need a running example. and please hurry :)
                existnresist Level 1

                ok, progress was made - thanks for the tip Ben! 

                on SDK 4.1 it now compiles and runs but the screen stays white. following is the complete MXML code, feedback will be VERY welcome.

                 

                thanks,

                r.

                 

                <?xml version="1.0" encoding="utf-8"?>

                <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                xmlns:s="library://ns.adobe.com/flex/spark"

                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"

                initialize="application1_initializeHandler(event)">

                <fx:Script>

                <![CDATA[

                import mx.events.FlexEvent;

                import caurina.transitions.*;

                 

                import flash.text.*;

                import flash.text.TextField;

                import flash.text.TextFieldAutoSize;

                 

                import flupie.textanim.*;

                 

                import mx.events.FlexEvent;

                 

                 

                function myEffect(block:TextAnimBlock):void {

                block.scaleX = block.scaleY = 0;

                block.rotation = -120;

                Tweener.addTween(block, {rotation:0, scaleX:1, scaleY:1, time:.5, transition:"easeoutback"});

                }


                protected function application1_initializeHandler(event:FlexEvent):void

                {

                var myTextField:TextField = new TextField();

                myTextField.x = 100;

                myTextField.y = 200;

                myTextField.htmlText = "TextAnim <font color=\"#FF0000\">Maker!</font> Lorem ipsum<br>tashin ishi quiring din.";

                myTextField.autoSize = "left";

                myTextField.embedFonts = true;

                con.addChild(myTextField);

                 

                var txtanim:TextAnim = new TextAnim(myTextField);

                txtanim.interval = 7;

                txtanim.blocksVisible = false;

                txtanim.effects = myEffect;

                txtanim.start();

                }


                ]]>

                </fx:Script>

                <fx:Declarations>

                <!-- Place non-visual elements (e.g., services, value objects) here -->

                </fx:Declarations>

                <s:SpriteVisualElement id="con" />

                </s:Application>