Hi Beno
What I meant was to start with something like this:
public function init():void {
hatAndFace();
eyeball1();
eyeball2();
myRightHand();
mcHandInstance2 = new mcHand();
addChild(mcHandInstance2)
}
What you did would have thrown an error because you hadn't assigned a value ot
mcHandInstance2, can't add null to the display list.
What you haven't told is whether all the other handlers work, is myRightHand()
creating the right hand and placing it on stage? What's different about
myRightHand() and myLeftHand()? Does myRightHand() also create an instance of
mcHand and put it visibly onstage? Does it use positional code to put in a
particular location?
I have to admit, not seeing the full code and knowing what works and what
doesn't makes it difficult to make any type of prediction. But if hatAndFace()
and all the rest worked and only myLeftHand() wasn't and that was the reason
for all the extra code in the init() method, I'd go back rip out the code in
the init that creates the mcHandInstance2, make the myLeftHand() call directly
as you did the rest. I'd double check that myRightHand() matched myLeftHand()
with a positional only difference. Then I'd make certain that the position I
was placing the left hand in was infact a visible screen location. I'd do like
Jason suggested, put in a trace in myLeftHand
public function init():void {
hatAndFace();
eyeball1();
eyeball2();
myRightHand();
myLeftHand();
}
I'd also put a trace after myRightHand() call, just to make sure that the stack
didn't quit out execution prior to hitting the myLeftHand() if all the traces
worked but no left hand, I'd assign the left hand to a public property and do
an inspection on x, y, alpha etc during debug to see what was going on. Be
methodical. Change one thing at a time from what is known to work ie. asusming
myRightHand() worked, duplicate that as myLeftHand() and change only the x
position. See if it works, etc.
Sincerely
Mark R. Jonkman
----- Original Message -----
From: "beno -" <[email protected]>
To: "Flash Coders List" <[email protected]>
Sent: Monday, December 7, 2009 1:07:20 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Flashcoders] Back On Course, Still Problems
Jason's suggestion of adding a trace to see if the class is even being
activated was excellent, thank you. No, it is not being activated.
I tried to comment out the mcHandInstance2 as per Mark's suggestion:
public function init():void {
hatAndFace();
eyeball1();
eyeball2();
myRightHand();
// var mcHandInstance2:mcHand = new mcHand();
addChild(mcHandInstance2)
mcHandInstance2.addFrameScript(20, myLeftHand)
// myLeftHand();
}
but it threw this error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChild()
at Main/init()
at main_fla::MainTimeline/frame1()
Mark informs me that I need to name these calls to mcHandInstance2 different
things; however, I still am greatly struggling to understand the fundamental
logic of what I'm trying to build. Can you help me understand how these
various elements work together so that I can properly name them? I, like
you, doubt seriously that I want them all to be the same name.
I'm sure Michael's suggestion was as good as Jason's, but obviously there
was no point for it, at least at this juncture, because the class is not
being activated.
If you all care to, please suggest google kw for me to research, but please
not the general educational information, of which I have studied some and
continue to study more. The learning curve is long and steep, par for the
course in programming, but frankly (and this is not a complaint!) apparently
longer and steeper than the norm with AS3.
TIA,
beno
package
{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.MovieClip;
import com.greensock.*;
import com.greensock.plugins.*;
import com.greensock.easing.*;
public class Main extends MovieClip
{
public var mcHandInstance2:mcHand;
public function Main():void
{
}
public function init():void {
hatAndFace();
eyeball1();
eyeball2();
myRightHand();
var mcHandInstance2:mcHand = new mcHand();
addChild(mcHandInstance2)
mcHandInstance2.addFrameScript(20, myLeftHand)
// myLeftHand();
}
public function hatAndFace():void
{
TweenPlugin.activate([AutoAlphaPlugin]);
var mcHatAndFaceInstance:mcHatAndFace = new mcHatAndFace();
addChild(mcHatAndFaceInstance);
mcHatAndFaceInstance.x = 350;
mcHatAndFaceInstance.y = 100;
mcHatAndFaceInstance.alpha = 0;
TweenLite.to(mcHatAndFaceInstance, 2, {autoAlpha:1});
}
public function eyeball1():void
{
var mcEyeballInstance1:mcEyeball = new mcEyeball();
addChild(mcEyeballInstance1);
mcEyeballInstance1.x = 380;
mcEyeballInstance1.y = 115;
mcEyeballInstance1.alpha = 0;
TweenLite.to(mcEyeballInstance1, 2, {autoAlpha:1});
}
public function eyeball2():void
{
var mcEyeballInstance2:mcEyeball = new mcEyeball();
addChild(mcEyeballInstance2);
mcEyeballInstance2.x = 315;
mcEyeballInstance2.y = 115;
mcEyeballInstance2.alpha = 0;
TweenLite.to(mcEyeballInstance2, 2, {autoAlpha:1});
}
public function myRightHand():void
{
var mcHandInstance1:mcHand = new mcHand();
addChild(mcHandInstance1);
mcHandInstance1.x = 400;
mcHandInstance1.y = 200;
}
/*
public function set totalProgress(value:Number):void
{
myLeftHand.value = 1;
}
*/
// private function myLeftHand():void
private function myLeftHand(e:Event=null):void
{
if (e.target.currentFrame == 10) { trace("yes") };
var mcHandInstance2:mcHand = new mcHand();
addChild(mcHandInstance2);
mcHandInstance2.x = 800;
mcHandInstance2.y = 200;
// if (e.target.currentFrame == 40) TweenMax.to(mcHandInstance2, 2,
{x:200, startAt:{totalProgress:1}}).reverse();
}
}
}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders