PDA

View Full Version : Child Movieclip is being a butthead


rpoy
10-30-2009, 03:56 AM
Hi!

I have created a movieclip called ENTRYForm and an associated AS class file. The form has a couple of custom controls that I made: checkbox, textbox, buttons and a listbox. By itself everything works fine - exactly as its supposed to.

I have another fla and class called DailyCheckList.as. The problem that I am having is that when I call the ENTRYForm, the checkbox which is in the ENTRYForm is in the checked state and it SHOULD be unchecked. Its as if the stop(); commands in the checkbox control are being ignored. It seems to have a mind of its own! Is there any reason for this?



package{
/**
*
* This is a daily checklist program that helps keep you on track
*/
import flash.display.NativeWindow;
import flash.desktop.NativeApplication;
import adobe.utils.ProductManager;
import flash.display.MovieClip;
import flash.display.*;
import flash.events.*;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.filesystem.*;
import roundedRectangle;
import HEADER;
import ENTRYForm;


public class DailyCheckList extends MovieClip
{
var _ContainerEF:Sprite = new Sprite();
var _EntryForm:ENTRYForm;
var _EFItem:String;
var _EFURL:String;
var _EFGroup:String;
var _aGroups:Array = new Array();
var _tw:Tween;

public function DailyCheckList():void
{
//Add the background
var bk:roundedRectangle = new roundedRectangle(400,550);
bk.FillColor = 0x999999;
bk.BorderColor = 0x999999;
bk.CornerRadius = 50;
bk.DrawSquare();
stage.addChild(bk);

//Add the Header
var Header_mc:MovieClip = new HEADER();
Header_mc.x = 10;
Header_mc.y =2;
bk.addChild(Header_mc);

//add the EntryFormContainer
bk.addChild(_ContainerEF);


//listeners
Header_mc.addEventListener( MouseEvent.MOUSE_DOWN, mouseDrag );
Header_mc.mcExit.addEventListener(MouseEvent.CLICK , onMouseExit);
Header_mc.mcSave.addEventListener(MouseEvent.CLICK , onSave);
Header_mc.mcNew.addEventListener(MouseEvent.CLICK, onNew);


//Load the XML File - And Set up the Group Array
_aGroups[0] = "1 test";
_aGroups[1] = "2 test";

}

//functions
private function mouseDrag(event:MouseEvent):void {
stage.nativeWindow.startMove();
}

private function onMouseExit(event:MouseEvent):void
{
//Close and exit the application
NativeApplication.nativeApplication.exit();
}

private function onSave(event:MouseEvent):void
{
//Save the groups and objects to an XML file
trace("onSave");
}

private function onNew(event:MouseEvent):void
{
//Present a Entry Form
_EntryForm = new ENTRYForm();
_EntryForm.x = 0;
_EntryForm.y = 100;
_EntryForm.alpha = 0;
_EntryForm.LoadListGroup = _aGroups;

_ContainerEF.addChild(_EntryForm);
_EntryForm.btnOK.addEventListener(MouseEvent.CLICK , onEntryOK);
_EntryForm.btnCancel.addEventListener(MouseEvent.C LICK, onEntryCancel);
TweenObject(_EntryForm, 1);
}

private function onEntryOK(event:MouseEvent):void
{
trace("Hit OK");
_EFGroup = _EntryForm.SelectedGroup;
_EFItem = _EntryForm.NameVal;
_EFURL = _EntryForm.URL;
trace("Group: " + _EFGroup);
trace("Item: " + _EFItem);
trace("URL: " + _EFURL);
TweenObject(_EntryForm, 0);
}


private function onEntryCancel(event:MouseEvent):void
{
trace("onEntryCancel");
TweenObject(_EntryForm, 0);
}


private function TweenObject(mc:MovieClip,Alpha:Number):void
{

_tw = new Tween(mc, "alpha", Strong.easeOut, mc.alpha, Alpha, 2, true);

if (Alpha==0)
{
_ContainerEF.removeChild(_EntryForm);
//_tw.addEventListener(_tw.MOTION_FINISH, function(mc:MovieClip) { _ContainerEF.removeChild(_EntryForm); } );
}

}

}

}