1 Reply Latest reply on Nov 8, 2009 7:00 PM by mewk

    What's wrong with this?

    Yahfree Level 1

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

      <mx:Application backgroundGradientColors="[0xFFE900, 0x850202]" layout="absolute" width="1000" height="600" applicationComplete="Init()" xmlns:mx="http://www.adobe.com/2006/mxml">

          <mx:Fade id="buttonon" duration="100" alphaFrom="1.0" alphaTo=".5"/>

          <mx:Fade id="buttonoff" duration="100" alphaFrom=".5" alphaTo="1.0"/>

          <mx:Sequence id="homeslide" repeatDelay="0" repeatCount="0" target="homelabel">

              <mx:Move duration="600" xBy="-50" />

              <mx:Move duration="600" xBy="50" />

          </mx:Sequence>

          <mx:Sequence id="aboutslide" repeatDelay="0" repeatCount="0" target="aboutlabel">

              <mx:Move duration="600" xBy="-50" />

              <mx:Move duration="600" xBy="50" />

          </mx:Sequence>

          <mx:Sequence id="contactslide" repeatDelay="0" repeatCount="0" target="contactlabel">

              <mx:Move duration="600" xBy="-50" />

              <mx:Move duration="600" xBy="50" />

          </mx:Sequence>

          <mx:Script><![CDATA[

      import mx.effects.easing.Quadratic;

      [Embed(source = "Media/button.png")]

      [Bindable]

      public var button:Class; 

       

      public function Init():void {

      }

      public function ChangePage(page:String):void {

      content.title = page;

      switch(page) {

      case "Home":

      case "About":

      case "Home":

      }

      }

      ]]></mx:Script>

          <mx:Image source="{button}" x="327" y="40" width="124" height="25" rollOutEffect="buttonoff" rollOverEffect="buttonon" rollOver="contactslide.play();" click="ChangePage('Contact');"/>

          <mx:Image source="{button}" x="188" y="40" width="124" height="25" rollOutEffect="buttonoff" rollOverEffect="buttonon" rollOver="aboutslide.play();" click="ChangePage('About');"/>

          <mx:Image source="{button}" x="49" y="40" width="124" height="25" rollOutEffect="buttonoff" rollOverEffect="buttonon" rollOver="homeslide.play();" click="ChangePage('Home');"/>

          <mx:Label id="homelabel" text="Home" fontWeight="bold" x="134" y="22" width="38" height="18"/>

          <mx:Label id="aboutlabel" text="About" fontWeight="bold" x="272" y="22" width="40" height="18"/>

          <mx:Label id="contactlabel" text="Contact" fontWeight="bold" x="403" y="22" width="49" height="18"/>

          <mx:Panel id="content" layout="absolute" title="Home" x="49" y="86" width="900" height="500"/>

      </mx:Application>

       

       

       

      --------------

       

      I get the follow error when rolling over a button, and I have no idea why?:

      TypeError: Error #1006: value is not a function.

      at mx.effects::EffectInstance/play()

      at mx.effects.effectClasses::CompositeEffectInstance/play()

      at mx.effects.effectClasses::SequenceInstance/play()

      at mx.effects::EffectInstance/startEffect()

      at mx.effects::Effect/play()

      at main/___main_Image1_rollOver()

        • 1. Re: What's wrong with this?
          mewk Level 3

          in your effects, targets need to reference objects, not strings -- it should look something like this:

           

          <mx:Sequence id="homeslide" repeatDelay="0" repeatCount="0" target="{homelabel}">
            <mx:Move duration="600" xBy="-50" />
            <mx:Move duration="600" xBy="50" />
          </mx:Sequence>
          

           

          - e

           

          edit: also repeatCount="0" means the effect repeats indefinitely.

           

          Message was edited by: mewk