hello there, 

maybe it's kind of newbie question, but it really teasing me.
here is my test code.


Flash Source (ver 8.0)

//to test following code,make mcTween movieclip has ten keyframe with 
different color,linkage name is mcTween
//then copy and paste it.
//publish setting, flash7, as2.0

stop();

import mx.transitions.*;
import mx.transitions.easing.*;

var aHeight:Array = new Array();
var bTrue = true;
var nCount:Number = 10;
var nC = 0;


function start():Void{
        
        //mcTween movieclip has ten keyframe with different color
        //make ten moviecliop mcTween0~mcTween9,  random height, 
then push that height value to aHeight Array
        for(var i=0; i<nCount; i++){
        
                mc = this.attachMovie("mcTween","mcTween"+i, i);
        
                mc._width = 40;
                mc._height = 50+randRange(10,50);               
                mc._x = mc._width*i+mc._x;
                mc.gotoAndStop(i+1);
                mc._y = 300;
                aHeight.push(mc._height);
                //uncomment following line, and mc._visible = 
true, in effect function,
                //1)publish swf, test in Flex,then swf doesn't 
show  what's wrong? 
                //mc._visible = false;          
        }
        effect();
}


function randRange(min:Number, max:Number):Number {
    var randomNum:Number = Math.floor(Math.random() * (max - min + 
1)) + min;
    return randomNum;
}


//tweening, from 0  to each mc's height value , interval time = 0.3 
second, duration 0.5
function effect():Void{
        
        var mc = _root["mcTween"+nC];
        
        var nInterval = 300;    
        var begin = 0;
        var time = .5;
        
        clearInterval(nID);
        
        mc.time = time;
        mc.easyType = mx.transitions.easing.Bounce.easeOut;;
        mc.begin = begin;
        //mc._visible = true;

        if(nC<nCount){
                
                if(bTrue){
                        nID = setInterval(effect,nInterval,nC);
                }               
                
                new Tween(mc, "_height", 
mc.easeType,mc.begin,aHeight[nC], mc.time, true);

                nC++;
                
        }
        
}

start();


Flex Source(ver 1.5)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>



<mx:Script>
<![CDATA[       
        import mx.transitions.*;
        import mx.transitions.easing.*;
        
]]>
</mx:Script>
        <mx:Panel title="Embed Flash Tweening">
                <mx:Canvas>
                        <mx:Image id="swf" source="@Embed
('tween.swf')" scaleContent="false" width="640" height="305"/>
                        //stark works fine each movieclip height 
changed,but tweening function doesn't work, 
                        
                        <mx:Button click="swf.content.start()" 
x="157" y="25"  label="Button" />                       
                        
                </mx:Canvas>
                <mx:ControlBar>
                </mx:ControlBar>
        </mx:Panel>
</mx:Application>


flex seems don't understand this line of code,
new Tween(mc, "_height", mc.easeType,mc.begin,aHeight[nC], mc.time, 
true); 


what i want to do is, 

1)embed swf in flex  without modification flash code, tweening 
movieclip like flash swf

2)mc._visible problem, 
uncomment //mc._visible = true; in start function, 
uncomment //mc._visible = true; in effect function,then embed swf 
invisible.

3)does anybody show mx.effect.tween usage, in Flash(not Flex, i know 
flexforflash only got mx.effect.tween ) 
if i modified flash source with mx.effects.tween, maybe it works fine 
in flex? 

sorry for my poor english, and thanks in advance.






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to