<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kimkijeung.com &#187; CS3</title>
	<atom:link href="http://kimkijeung.com/tag/cs3/feed/" rel="self" type="application/rss+xml" />
	<link>http://kimkijeung.com</link>
	<description>Interactive development,flash,Actionscript</description>
	<lastBuildDate>Wed, 25 Aug 2010 09:12:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<image>
			<title>Kimkijeung.com</title>
			<url>http://kimkijeung.com/blog/wp-content/uploads/2009/12/index.gif</url>
			<link>http://kimkijeung.com</link>
			<width></width>
			<height></height>
			<description>Interactive development,flash,Actionscript</description>
		</image>		<item>
		<title>Tween Engine Class -AS3.0</title>
		<link>http://kimkijeung.com/2007/08/09/tween-engine-class-as3-0/</link>
		<comments>http://kimkijeung.com/2007/08/09/tween-engine-class-as3-0/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 12:27:52 +0000</pubDate>
		<dc:creator>vkimone</dc:creator>
				<category><![CDATA[Flash-AS3.0]]></category>
		<category><![CDATA[AS3.0]]></category>
		<category><![CDATA[CS3]]></category>
		<category><![CDATA[TweenEngine]]></category>

		<guid isPermaLink="false">http://vkimone.inblog.kr/?p=489</guid>
		<description><![CDATA[flash 를 사용하면서 가장 많이 사용하는 부분은 아마도 트윈 부분일 것이다. 오브젝트의 속성값을 변경하면서 수많은 느낌의 모션을 만들수 있었다. 기존에 포함되어 있는 Tween 클래스는 많은 사용자들이 이런  다양한 트윈을 손쉽게 구현할 수 있게 해준다. 하지만, 생각보다 많은 기능들이 포함되어있어서 덩치도 클뿐더러 구현하는 코드 자체도 길어지게 되었다. 또한 AS3.0에서는 garbage collection 의 동작으로 인해 참조값이 없는 [...]]]></description>
			<content:encoded><![CDATA[<p>flash 를 사용하면서 가장 많이 사용하는 부분은 아마도 트윈 부분일 것이다. 오브젝트의 속성값을 변경하면서 수많은 느낌의 모션을 만들수 있었다.<br />
기존에 포함되어 있는 Tween 클래스는 많은 사용자들이 이런  다양한 트윈을 손쉽게 구현할 수 있게 해준다. 하지만, 생각보다 많은 기능들이 포함되어있어서 덩치도 클뿐더러 구현하는 코드 자체도 길어지게 되었다.<br />
또한 AS3.0에서는 garbage collection 의 동작으로 인해 참조값이 없는 객체에 대해서는 collector 에 의해 메모리 수집의 대상이 되기 때문에 트윈클래스의 인스턴스를 지역변수로 참조하여 사용하게 되면 뜻하지 않게 트윈이 완료되기 이전에 객체가 사라지는 문제가 발생할 수도 있다..<br />
따라서 이런 문제를 해결하기 위해 지역변수보다 좀더 높은 클래스 단계의 scope 의 참조를 사용하게 되는데 이럴경우 불필요하게 많은 참조 변수들을 클래스가 가지게되여 메모리를 소비하게 된다.</p>
<p>그리고 가장 빈번히 사용하게 되는 트윈의 경우 일일이 이벤트 핸들러 함수를 구현하기가 여간 번거로운게 아니다. 코드자체의 길이도 길어질 뿐만 아니라 가독성 측면에서도 떨어지는게 사실이다.</p>
<p>이런 문제를 조금이나마 해결하고자 <a href="http://kimkijeung.com/entry/Tween-class">이전 버전</a>의 Tween 클래스를 기반으로 AS3.0 으로 컨버팅하였다.</p>
<p>기본적은 틀은 이전에 AS2.0 으로 구현한 로직과 큰 차이는 없다.<br />
참조값을 유지하기 위해 전역속성으로 트윈을 적용하였고 객체를 생성하지 않아도 되기 때문에 한결 코드도 간결해졌다.</p>
<p><strong>***** update(2007.10.30) ******</strong></p>
<p>pause 와 resume 기능을 추가<br />
원하는 오브젝트의 트윈에 적용가능함</p>
<p>pause(), pauseAll() 나 resume(), resumeAll() 를 사용하여 전체또는 부분적인 트윈을 제어할 수 있다.</p>
<p><object style="width: 300px; height: 120px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="120" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="menu" value="false" /><param name="src" value="/blog/wp-content/uploads/2009/12/tweenSample.swf" /><embed style="width: 300px; height: 120px;" type="application/x-shockwave-flash" width="300" height="120" src="/blog/wp-content/uploads/2009/12/tweenSample.swf" menu="false"></embed></object></p>
<p><strong>&lt;TweenEngine class&gt;</strong></p>
<p><strong> </strong></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> com.dstrict.ub.utils.transitions<span style="color: #000000;">&#123;</span>
&nbsp;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">DisplayObject</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #000000; font-weight: bold;">*</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span>.<span style="color: #004993;">Dictionary</span>;
 <span style="color: #3f5fbf;">/**
  DisplayObject tween class
  트윈을 적용할 속성의 갯수에 관계없이 일괄적으로 적용가능
  마지막 parameter 로 정해진 형식의 이벤트 오브젝트 적용시 이벤트 시작과 끝을 tracking 할 수 있음. 
&nbsp;
  @example code
  &lt;code&gt;
&nbsp;
   function onTweenStart(param):void{
    trace(&quot;onTweenStart----&amp;gt;&quot;+param);
   }
&nbsp;
   function onTweenFinish(param):void{
    trace(&quot;onTweenFinish----&amp;gt;&quot;+param);
   }
&nbsp;
TweenEngine.start(circle,{x:400},Regular.easeOut,30,{onStart:onTweenStart,
onStartParams:[&quot;circle&quot;],onFinish:onTweenFinish,onFinishParams:[&quot;circle&quot;]});
 &lt;/code&gt;
&nbsp;
 */</span>
&nbsp;
 <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> TweenEngine <span style="color: #000000;">&#123;</span>
   <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> _referContainer <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Dictionary</span>=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Dictionary</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
  <span style="color: #3f5fbf;">/**
   @param targetObj : DisplayObject , tween 적용할 오브젝트
   @param tweenProperty : Object , 속성오브젝트 ex. {x:100,y:100,alpha:1}
   @param easing : Function , 이징함수
   @param duration : int , 지속프레임
   @param rest : Obejct , [optional]  event object
   ex. {onStart:onTweenStart,onStartParams:[],onFinish:onTweenFinish,onFinishParams:[]}
  */</span>
  <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span>targetObj<span style="color: #000000; font-weight: bold;">:*</span>,tweenProperty<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span>,easing<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Function</span>,duration<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>,...rest<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
   <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">time</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">1</span>;
   <span style="color: #6699cc; font-weight: bold;">var</span> beginning<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span>=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
   <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">change</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span>=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
   <span style="color: #6699cc; font-weight: bold;">var</span> isCreated <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span>=<span style="color: #0033ff; font-weight: bold;">false</span>;
   <span style="color: #6699cc; font-weight: bold;">var</span> displayObj <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">DisplayObject</span>;
&nbsp;
   TweenEngine.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span>targetObj<span style="color: #000000;">&#41;</span>;
&nbsp;
   <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span><span style="color: #000000;">&#40;</span>targetObj <span style="color: #0033ff; font-weight: bold;">is</span> <span style="color: #004993;">DisplayObject</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
      displayObj = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Shape</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
      isCreated=<span style="color: #0033ff; font-weight: bold;">true</span>;
    <span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
      displayObj = targetObj;
     <span style="color: #000000;">&#125;</span>
&nbsp;
   <span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:*</span> <span style="color: #0033ff; font-weight: bold;">in</span> tweenProperty<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
       beginning.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>targetObj<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
       <span style="color: #004993;">change</span>.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>tweenProperty<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">-</span>targetObj<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
   <span style="color: #000000;">&#125;</span>
&nbsp;
   <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>rest.<span style="color: #004993;">length</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; rest<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span>.onStart<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #6699cc; font-weight: bold;">var</span> eventStartObject<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span>=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Object</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    eventStartObject.onStart=rest<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span>.onStart;
    eventStartObject.onStartParams=rest<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span>.onStartParams;
&nbsp;
    <span style="color: #009900;">//onStart event</span>
    eventStartObject.onStart.<span style="color: #004993;">apply</span><span style="color: #000000;">&#40;</span>eventStartObject,eventStartObject.onStartParams<span style="color: #000000;">&#41;</span>;
   <span style="color: #000000;">&#125;</span>
&nbsp;
   <span style="color: #009900;">//Nested function</span>
   <span style="color: #6699cc; font-weight: bold;">var</span> update<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Function</span>=<span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #6699cc; font-weight: bold;">var</span> objIdx<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">0</span>;
      <span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:*</span> <span style="color: #0033ff; font-weight: bold;">in</span> tweenProperty<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
       targetObj<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>=easing<span style="color: #000000;">&#40;</span><span style="color: #004993;">time</span>,beginning<span style="color: #000000;">&#91;</span>objIdx<span style="color: #000000;">&#93;</span>,<span style="color: #004993;">change</span><span style="color: #000000;">&#91;</span>objIdx<span style="color: #000000;">&#93;</span>,duration<span style="color: #000000;">&#41;</span>;
       objIdx<span style="color: #000000; font-weight: bold;">++</span>;
      <span style="color: #000000;">&#125;</span>
      <span style="color: #004993;">time</span><span style="color: #000000; font-weight: bold;">++</span>;
      <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>time<span style="color: #000000; font-weight: bold;">&amp;</span>gt;duration<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
      <span style="color: #0033ff; font-weight: bold;">delete</span> _referContainer<span style="color: #000000;">&#91;</span>displayObj<span style="color: #000000;">&#93;</span>;
       displayObj.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>,update<span style="color: #000000;">&#41;</span>;
       <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>isCreated<span style="color: #000000;">&#41;</span> displayObj=<span style="color: #0033ff; font-weight: bold;">null</span>;
&nbsp;
       <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>rest.<span style="color: #004993;">length</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; rest<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span>.onFinish<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
        <span style="color: #6699cc; font-weight: bold;">var</span> eventFinishObject<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span>=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Object</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
        eventFinishObject.onFinish=rest<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span>.onFinish;
        eventFinishObject.onFinishParams=rest<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span>.onFinishParams;
&nbsp;
        <span style="color: #009900;">//onFinish event</span>
        eventFinishObject.onFinish.<span style="color: #004993;">apply</span><span style="color: #000000;">&#40;</span>eventFinishObject,eventFinishObject.onFinishParams<span style="color: #000000;">&#41;</span>;
       <span style="color: #000000;">&#125;</span>
     <span style="color: #000000;">&#125;</span>
   <span style="color: #000000;">&#125;</span>
     _referContainer<span style="color: #000000;">&#91;</span>displayObj<span style="color: #000000;">&#93;</span> = update;
      displayObj.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>,update<span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #009900;">//Update 2007.10.30</span>
  <span style="color: #3f5fbf;">/**
   * Pause a tweening for a given object.
   */</span>
  <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span>  <span style="color: #004993;">pause</span><span style="color: #000000;">&#40;</span>targetObj <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
   <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>targetObj.<span style="color: #004993;">hasEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    targetObj.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, _referContainer<span style="color: #000000;">&#91;</span>targetObj<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
   <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #3f5fbf;">/**
   * Pause all tweenings on the engine.
   */</span>
 <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> pauseAll<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
   <span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> item<span style="color: #000000; font-weight: bold;">:*</span> <span style="color: #0033ff; font-weight: bold;">in</span> _referContainer<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>item.<span style="color: #004993;">hasEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
     item.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, _referContainer<span style="color: #000000;">&#91;</span>item<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
   <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #3f5fbf;">/**
   * Resume a tweening from a given object.
   */</span>
  <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">resume</span><span style="color: #000000;">&#40;</span>targetObj <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
   <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>_referContainer<span style="color: #000000;">&#91;</span>targetObj<span style="color: #000000;">&#93;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    targetObj.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, _referContainer<span style="color: #000000;">&#91;</span>targetObj<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
   <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #3f5fbf;">/**
   * Resume all tweenings on the engine.
   */</span>
  <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> resumeAll<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
   <span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> item<span style="color: #000000; font-weight: bold;">:*</span> <span style="color: #0033ff; font-weight: bold;">in</span> _referContainer<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>_referContainer<span style="color: #000000;">&#91;</span>item<span style="color: #000000;">&#93;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
     item.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, _referContainer<span style="color: #000000;">&#91;</span>item<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
   <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #3f5fbf;">/**
   *  Stop a tweening for a given object
   */</span>
  <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span>targetObj <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
   <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>targetObj.<span style="color: #004993;">hasEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    targetObj.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, _referContainer<span style="color: #000000;">&#91;</span>targetObj<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #0033ff; font-weight: bold;">delete</span> _referContainer<span style="color: #000000;">&#91;</span>targetObj<span style="color: #000000;">&#93;</span>;
   <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #3f5fbf;">/**
   * Remove all tweenings from the engine.
   */</span>
  <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">stopAll</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
   <span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> item<span style="color: #000000; font-weight: bold;">:*</span> <span style="color: #0033ff; font-weight: bold;">in</span> _referContainer<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>item.<span style="color: #004993;">hasEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
     item.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, _referContainer<span style="color: #000000;">&#91;</span>item<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
     <span style="color: #0033ff; font-weight: bold;">delete</span> _referContainer<span style="color: #000000;">&#91;</span>item<span style="color: #000000;">&#93;</span>;
    <span style="color: #000000;">&#125;</span>
   <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
 <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">import</span> com.dstrict.ub.utils.transitions.<span style="color: #000000; font-weight: bold;">*</span>;
<span style="color: #0033ff; font-weight: bold;">import</span> fl.motion.easing.<span style="color: #000000; font-weight: bold;">*</span>;
&nbsp;
TweenEngine.<span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span>circle,<span style="color: #000000;">&#123;</span><span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">400</span>,<span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">300</span><span style="color: #000000;">&#125;</span>,Cubic.easeInOut,<span style="color: #000000; font-weight:bold;">20</span>,<span style="color: #000000;">&#123;</span>onStart<span style="color: #000000; font-weight: bold;">:</span>onTweenStart,onStartParams<span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;circle start&quot;</span><span style="color: #000000;">&#93;</span>,
onFinish<span style="color: #000000; font-weight: bold;">:</span>onTweenFinish,onFinishParams<span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;circle finish&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #009900;">//----&amp;gt; 마지막 오브젝트 값은 이벤트 핸들러를 참조하는 값으로 옵션사항이다.</span>
            단, 사용시 이벤트 오브젝에서 함수이름을 onStart , onFinish 로
            이벤트 파라미터를 onStartParams,onFinishParams 로 키값을 사용해야만 한다.
&nbsp;
 <span style="color: #339966; font-weight: bold;">function</span> onTweenStart<span style="color: #000000;">&#40;</span>param<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
   <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;onTweenStart----&amp;gt;&quot;</span><span style="color: #000000; font-weight: bold;">+</span>param<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> onTweenFinish<span style="color: #000000;">&#40;</span>param<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
  <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;onTweenFinish----&amp;gt;&quot;</span><span style="color: #000000; font-weight: bold;">+</span>param<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900;">//stop tween</span>
<span style="color: #004993;">stage</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>,onStop<span style="color: #000000;">&#41;</span>;
<span style="color: #339966; font-weight: bold;">function</span> onStop<span style="color: #000000;">&#40;</span>evt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
 TweenEngine.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span>circle<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><a href="/blog/wp-content/uploads/2009/12/Tween-Engine-V1.5.zip" target="_self">download sample</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kimkijeung.com/2007/08/09/tween-engine-class-as3-0/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Changing the frame rate in movie</title>
		<link>http://kimkijeung.com/2006/08/16/changing-the-frame-rate-in-movie/</link>
		<comments>http://kimkijeung.com/2006/08/16/changing-the-frame-rate-in-movie/#comments</comments>
		<pubDate>Wed, 16 Aug 2006 05:41:33 +0000</pubDate>
		<dc:creator>vkimone</dc:creator>
				<category><![CDATA[Flash-AS3.0]]></category>
		<category><![CDATA[Flash-CS3]]></category>
		<category><![CDATA[AS3.0]]></category>
		<category><![CDATA[CS3]]></category>

		<guid isPermaLink="false">http://vkimone.inblog.kr/?p=264</guid>
		<description><![CDATA[Using ActionScript 3, you can dynamically change the frame rate of your movie using the Stage class. The Stage class (flash.display.Stage) is the class assigned to the stage object which is accessible from your main movie sprite/movie clip (or others within the same security sandbox) using the stage property. The stage object has a frameRate [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Using ActionScript 3, you can dynamically change the frame rate of your movie using the Stage class.</p>
<p>The Stage class (flash.display.Stage) is the class assigned to the stage object which is accessible from your main movie sprite/movie clip (or others within the same security sandbox) using the stage property. The stage object has a frameRate property which can contain any value between 0.01 and 1000 and determines the frame rate at which the Flash player plays back your movie. Changing this value lets you change the frame rate at runtime.</p></blockquote>
<p>// change frame rate to 12 fps:</p>
<p>stage.frameRate = 12;</p>
<p>이전 버전에서는 한번 정한  framerate 는 바뀔수가 없었다. 즉 동적으로 frame 속도를 조절할수 없었음.</p>
<p>근데 과연 frameRate 가 1000까지 지원할까?&#8230;. 지원하더라도 눈으로 확인은 불가능 할듯.</p>
<p>다만 각각의 swf 파일의 속도는 조절안되고 전체 stage 의 속도만 조절되는것 같다.</p>
]]></content:encoded>
			<wfw:commentRss>http://kimkijeung.com/2006/08/16/changing-the-frame-rate-in-movie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
