dimanche 5 mars 2017

TypeError: Error #1006: value is not a function (AS3)

I'm going to make a puzzle game. When I clik the puzzle, it can't move and show an output error.

TypeError: Error #1006: value is not a function.
at Puzzles_fla::MainTimeline/dragObjek()
at Puzzles_fla::MainTimeline/frame2()
at flash.display::MovieClip/gotoAndStop()
at Puzzles_fla::MainTimeline/btn_1()

My code is

var ypos:int;
var xpos:int;
dragObjek(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); // definisi bagian" dari puzzle

menu1.addEventListener(MouseEvent.CLICK, btn_menu1);

function btn_menu1(e:MouseEvent):void{
    gotoAndStop(1); // untuk kembali ke menu

function getPos(target:Object){
    xpos = target.x;
    ypos = target.y;

function startdrag(event:MouseEvent){

function stopdrag(event:MouseEvent){
       event.target.x = getChildByName(event.target.name+"Target").x;
       event.target.y = getChildByName(event.target.name+"Target").y;
    event.target.x = xpos;
    event.target.y = ypos;

function dragObjek(... objects){
    for (var i:int = 0; i < objects.length; i++){
        objects[i].addEventListener(MouseEvent.MOUSE_DOWN, startdrag);
        objects[i].addEventListener(MouseEvent.MOUSE_UP, stopdrag);

I am using AS3 on Adobe Flash CS6. The puzzle can't be drag and I can't go back to the Menu frame.

Aucun commentaire:

Enregistrer un commentaire