 	public function AddActionInstance(target:Object)
 	{
 		super(target);
+        try {
+            target.parent;
+            hasParent = true;
+        } catch (e:Error) {
+            hasParent = false;
+        }
 	}
 	
 	//--------------------------------------------------------------------------

    
    private function addChildAt(container:*, child:*, index:int):void
    {
        if (hasParent)
           container.addChildAt(child, index);
        else
           container.addItemAt(child, index);

		if (!mx_internal::playReversed)
		{
			// Set the style property
			if (target && getContainer(target) == null && relativeTo)
			{
				switch (position)
				{
					case "index":
					{
						if (index == -1)
							addChild(relativeTo, target);
						else
							addChildAt(relativeTo, target, 
												Math.min(index, relativeTo.numChildren));
						break;
					}
					
					case "before":
					{
						addChildAt(getContainer(relativeTo), target,
							getChildIndex(getContainer(relativeTo), relativeTo));
						break;
					}

					case "after":
					{
						addChildAt(getContainer(relativeTo), target,
							getChildIndex(getContainer(relativeTo), relativeTo) + 1);
						break;
					}
					
					case "firstChild":
					{
						addChildAt(relativeTo, target, 0);
					}
					
					case "lastChild":
					{
						addChild(relativeTo, target);
					}
				}
			}
		}
		else
		{
			if (target && relativeTo && getContainer(target) == relativeTo)
			{
				removeChild(relativeTo, target);
			}
		}
		
