foutmelding na muisklik

  • Onderwerp starter Onderwerp starter peko
  • Startdatum Startdatum
Status
Niet open voor verdere reacties.

peko

Gebruiker
Lid geworden
25 jan 2006
Berichten
155
Na een mouse event CLICK krijg ik de volgende melding
.......
knop doet t
TypeError: Error #1009: Kan geen eigenschap of methode benaderen via een verwijzing naar een object dat null is.
at 2010nr2_fla::MainTimeline/loop()
.......

Zo je ziet doet de trace functie het maar de melding dat er verwezen wordt naar een NULL object begrijp ik niet want het commando is dat er in dezelfde scene naar frame 1 met label "frame1" moet worden teruggegaan.

Wat kan ik doen om de foutmelding weg te krijgen.

Alvast dank voor de respons
peko

De code:
Code:
trg.addEventListener(MouseEvent.CLICK, trg_CLICK);

function trg_CLICK(e:MouseEvent):void
{
	trace("knop doet t");
	this.gotoAndPlay("frame1");
}
 
Aanvulling......

Vele mogelijkheden geprobeerd zoals trace / getURL enz. Deze werken allemaal maar als ik de functies gotoAndPlay of gotoAndStop laat uitvoeren dan komt de foutmelding.

Nog een aanvulling.......

Heb geconstateerd dat alles het doet totdat er een ander stuk script wordt aangeroepen. Dit ziet er als volgt uit:

ActionScript 3 Code:

Code:
addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void {
	
	if (about.scaleX>=1) {
		about.addChild(about.theInfo);
	} else {
		
		about.addChild(about.theImage);
	}


Als dit stuk script wordt "geblokd" dan doet alles het goed. Maar dan mis ik een stuk noodzakelijke interactie in de movie

Hoe kan ik er voor zorgen dat beide scripts samenwerken?????


Weer een aanvulling...

Voor alle duidelijkheid volgt hier het hele script met de hierboven genoemde code.

Er staan 4 mc's op de tijdlijn. Elk bevat een image(theImage) en een FLVplayback (theInfo)

In eerste instantie zie je alleen het plaatje. Deze hebben een button functie en als je erop klikt dan vervaagd de image en komt de player naar voren.

Kijk anders even op
http://www.jpkdesign.nl/animatie.html

De code die voor dit deel gebruikt wordt is als volgt:


Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import fl.motion.MotionEvent;

var aboutX=about.x;
var aboutY=about.y;
var aboutScaleX=about.scaleX;
var aboutScaleY=about.scaleY;
var aboutRotation=about.rotation;

about.theImage.buttonMode=true;

about.theImage.addEventListener(MouseEvent.CLICK, aboutOver);
function aboutOver(e:Event):void {
    addChild(about);

    new Tween(about,"scaleX",Regular.easeInOut,aboutScaleX,1,1,true);
    new Tween(about,"scaleY",Regular.easeInOut,aboutScaleY,1,1,true);

    new Tween(about,"rotation",Regular.easeInOut,aboutRotation,0,1,true);

    new Tween(about,"x",Regular.easeInOut,aboutX,stage.stageWidth/2,1,true);
    new Tween(about,"y",Regular.easeInOut,aboutY,stage.stageHeight/2,1,true);

    new Tween(about,"rotationY",Regular.easeInOut,about.rotationY,180,0,true);
    new Tween(about,"rotationX",Regular.easeInOut,about.rotationX,180,0,true);
    new Tween(about.theImage,"alpha",Regular.easeOut,about.theImage.alpha,0,1,true);
}

about.theInfo.spin.addEventListener(MouseEvent.CLICK, aboutBack);
function aboutBack(e:Event):void {

    new Tween(about,"scaleX",Regular.easeInOut,about.scaleX,aboutScaleX,1,true);
    new Tween(about,"scaleY",Regular.easeInOut,about.scaleY,aboutScaleY,1,true);

    new Tween(about,"rotation",Regular.easeInOut,about.rotation,aboutRotation,0,true);

    new Tween(about,"x",Regular.easeInOut,about.x,aboutX,1,true);
    new Tween(about,"y",Regular.easeInOut,about.y,aboutY,1,true);

    new Tween(about,"rotationY",Regular.easeInOut,about.rotationY,360,0,true);
    new Tween(about,"rotationX",Regular.easeInOut,about.rotationX,360,0,true);
    new Tween(about.theImage,"alpha",Regular.easeIn,about.theImage.alpha,1,1,true);
}



addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void {

    if (about.scaleX>=1) {
        about.addChild(about.theInfo);
    } else {

        about.addChild(about.theImage);
    }


    if (port.scaleX>=1) {
        port.addChild(port.theInfo);
    } else {

        port.addChild(port.theImage);
    }
   
if (logo.scaleX>=1) {
        logo.addChild(logo.theInfo);
    } else {

        logo.addChild(logo.theImage);
    }
       
   
    if (valentijn.scaleX>=1) {
        valentijn.addChild(valentijn.theInfo);
    } else {

        valentijn.addChild(valentijn.theImage);
    }

}


var portX=port.x;
var portY=port.y;
var portScaleX=port.scaleX;
var portScaleY=port.scaleY;
var portRotation=port.rotation;


port.theImage.buttonMode=true;

port.theImage.addEventListener(MouseEvent.CLICK, portOver);
function portOver(e:Event):void {
    addChild(port);

    new Tween(port,"scaleX",Regular.easeInOut,portScaleX,1,1,true);
    new Tween(port,"scaleY",Regular.easeInOut,portScaleY,1,1,true);

    new Tween(port,"rotation",Regular.easeInOut,portRotation,0,1,true);

    new Tween(port,"x",Regular.easeInOut,portX,stage.stageWidth/2,1,true);
    new Tween(port,"y",Regular.easeInOut,portY,stage.stageHeight/2,1,true);

    new Tween(port,"rotationY",Regular.easeInOut,port.rotationY,180,0,true);
    new Tween(port,"rotationX",Regular.easeInOut,port.rotationX,180,0,true);
    new Tween(port.theImage,"alpha",Regular.easeOut,port.theImage.alpha,0,1,true);
}

port.theInfo.spin.addEventListener(MouseEvent.CLICK, portBack);
function portBack(e:Event):void {

    new Tween(port,"scaleX",Regular.easeInOut,port.scaleX,portScaleX,1,true);
    new Tween(port,"scaleY",Regular.easeInOut,port.scaleY,portScaleY,1,true);
    //rotate back
    new Tween(port,"rotation",Regular.easeInOut,port.rotation,portRotation,1,true);
    //move back
    new Tween(port,"x",Regular.easeInOut,port.x,portX,1,true);
    new Tween(port,"y",Regular.easeInOut,port.y,portY,1,true);
    //3D back
    new Tween(port,"rotationY",Regular.easeInOut,port.rotationY,360,0,true);
    new Tween(port,"rotationX",Regular.easeInOut,port.rotationX,360,0,true);
    new Tween(port.theImage,"alpha",Regular.easeIn,port.theImage.alpha,1,1,true);
    }
   

var logoX=logo.x;
var logoY=logo.y;
var logoScaleX=logo.scaleX;
var logoScaleY=logo.scaleY;
var logoRotation=logo.rotation;

logo.theImage.buttonMode=true;

logo.theImage.addEventListener(MouseEvent.CLICK, logoOver);
function logoOver(e:Event):void {
    addChild(logo);

    new Tween(logo,"scaleX",Regular.easeInOut,logoScaleX,1,1,true);
    new Tween(logo,"scaleY",Regular.easeInOut,logoScaleY,1,1,true);

    new Tween(logo,"rotation",Regular.easeInOut,logoRotation,0,1,true);

    new Tween(logo,"x",Regular.easeInOut,logoX,stage.stageWidth/2,1,true);
    new Tween(logo,"y",Regular.easeInOut,logoY,stage.stageHeight/2,1,true);
    //3D around
    new Tween(logo,"rotationY",Regular.easeInOut,logo.rotationY,180,0,true);
    new Tween(logo,"rotationX",Regular.easeInOut,logo.rotationX,180,0,true);
    new Tween(logo.theImage,"alpha",Regular.easeOut,logo.theImage.alpha,0,1,true);
}

logo.theInfo.spin.addEventListener(MouseEvent.CLICK, logoBack);
function logoBack(e:Event):void {

    new Tween(logo,"scaleX",Regular.easeInOut,logo.scaleX,logoScaleX,1,true);
    new Tween(logo,"scaleY",Regular.easeInOut,logo.scaleY,logoScaleY,1,true);

    new Tween(logo,"rotation",Regular.easeInOut,logo.rotation,logoRotation,1,true);

    new Tween(logo,"x",Regular.easeInOut,logo.x,logoX,1,true);
    new Tween(logo,"y",Regular.easeInOut,logo.y,logoY,1,true);

    new Tween(logo,"rotationY",Regular.easeInOut,logo.rotationY,360,0,true);
    new Tween(logo,"rotationX",Regular.easeInOut,logo.rotationX,360,0,true);
    new Tween(logo.theImage,"alpha",Regular.easeIn,logo.theImage.alpha,1,1,true);
    }
   
   

var valentijnX=valentijn.x;
var valentijnY=valentijn.y;
var valentijnScaleX=valentijn.scaleX;
var valentijnScaleY=valentijn.scaleY;
var valentijnRotation=valentijn.rotation;


valentijn.theImage.buttonMode=true;

valentijn.theImage.addEventListener(MouseEvent.CLICK, valentijnOver);
function valentijnOver(e:Event):void {
    addChild(valentijn);

    new Tween(valentijn,"scaleX",Regular.easeInOut,valentijnScaleX,1,1,true);
    new Tween(valentijn,"scaleY",Regular.easeInOut,valentijnScaleY,1,1,true);

    new Tween(valentijn,"rotation",Regular.easeInOut,valentijnRotation,0,1,true);

    new Tween(valentijn,"x",Regular.easeInOut,valentijnX,stage.stageWidth/2,1,true);
    new Tween(valentijn,"y",Regular.easeInOut,valentijnY,stage.stageHeight/2,1,true);

    new Tween(valentijn,"rotationY",Regular.easeInOut,valentijn.rotationY,180,0,true);
    new Tween(valentijn,"rotationX",Regular.easeInOut,valentijn.rotationX,180,0,true);
    new Tween(valentijn.theImage,"alpha",Regular.easeOut,valentijn.theImage.alpha,0,1,true);
}

valentijn.theInfo.spin.addEventListener(MouseEvent.CLICK, valentijnBack);
function valentijnBack(e:Event):void {

    new Tween(valentijn,"scaleX",Regular.easeInOut,valentijn.scaleX,valentijnScaleX,1,true);
    new Tween(valentijn,"scaleY",Regular.easeInOut,valentijn.scaleY,valentijnScaleY,1,true);

    new Tween(valentijn,"rotation",Regular.easeInOut,valentijn.rotation,valentijnRotation,1,true);

    new Tween(valentijn,"x",Regular.easeInOut,valentijn.x,valentijnX,1,true);
    new Tween(valentijn,"y",Regular.easeInOut,valentijn.y,valentijnY,1,true);

    new Tween(valentijn,"rotationY",Regular.easeInOut,valentijn.rotationY,360,0,true);
    new Tween(valentijn,"rotationX",Regular.easeInOut,valentijn.rotationX,360,0,true);
    new Tween(valentijn.theImage,"alpha",Regular.easeIn,valentijn.theImage.alpha,1,1,true);
    }
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan