| 1 |
/* |
|---|
| 2 |
* BetweenAS3 |
|---|
| 3 |
* |
|---|
| 4 |
* Licensed under the MIT License |
|---|
| 5 |
* |
|---|
| 6 |
* Copyright (c) 2009 BeInteractive! (www.be-interactive.org) and |
|---|
| 7 |
* Spark project (www.libspark.org) |
|---|
| 8 |
* |
|---|
| 9 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|---|
| 10 |
* of this software and associated documentation files (the "Software"), to deal |
|---|
| 11 |
* in the Software without restriction, including without limitation the rights |
|---|
| 12 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|---|
| 13 |
* copies of the Software, and to permit persons to whom the Software is |
|---|
| 14 |
* furnished to do so, subject to the following conditions: |
|---|
| 15 |
* |
|---|
| 16 |
* The above copyright notice and this permission notice shall be included in |
|---|
| 17 |
* all copies or substantial portions of the Software. |
|---|
| 18 |
* |
|---|
| 19 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|---|
| 20 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 21 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|---|
| 22 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|---|
| 23 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|---|
| 24 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|---|
| 25 |
* THE SOFTWARE. |
|---|
| 26 |
* |
|---|
| 27 |
*/ |
|---|
| 28 |
package org.libspark.betweenas3.core.tweens.actions |
|---|
| 29 |
{ |
|---|
| 30 |
import flash.display.DisplayObject; |
|---|
| 31 |
import flash.display.DisplayObjectContainer; |
|---|
| 32 |
import org.libspark.betweenas3.core.ticker.ITicker; |
|---|
| 33 |
import org.libspark.betweenas3.core.tweens.AbstractActionTween; |
|---|
| 34 |
|
|---|
| 35 |
/** |
|---|
| 36 |
* 指定された DisplayObject を親から削除する動作を行うアクショントゥイーンです. |
|---|
| 37 |
* |
|---|
| 38 |
* @author yossy:beinteractive |
|---|
| 39 |
*/ |
|---|
| 40 |
public class RemoveFromParentAction extends AbstractActionTween |
|---|
| 41 |
{ |
|---|
| 42 |
public function RemoveFromParentAction(ticker:ITicker, target:DisplayObject) |
|---|
| 43 |
{ |
|---|
| 44 |
super(ticker); |
|---|
| 45 |
|
|---|
| 46 |
_target = target; |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
private var _target:DisplayObject; |
|---|
| 50 |
private var _parent:DisplayObjectContainer; |
|---|
| 51 |
|
|---|
| 52 |
public function get target():DisplayObject |
|---|
| 53 |
{ |
|---|
| 54 |
return _target; |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
override protected function action():void |
|---|
| 58 |
{ |
|---|
| 59 |
if (_target != null && _target.parent != null) { |
|---|
| 60 |
_parent = _target.parent; |
|---|
| 61 |
_parent.removeChild(_target); |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
override protected function rollback():void |
|---|
| 66 |
{ |
|---|
| 67 |
if (_target != null && _parent != null) { |
|---|
| 68 |
_parent.addChild(_target); |
|---|
| 69 |
_parent = null; |
|---|
| 70 |
} |
|---|
| 71 |
} |
|---|
| 72 |
} |
|---|
| 73 |
} |
|---|