Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

as3 Problem

New Here ,
Mar 05, 2013 Mar 05, 2013

I was wondering how you can edit a Movie Clip, in one frame when the action script controlling it is on another frame. (Both in the same layer though.)

The context is I am making a maze game and each frame is a room on the maze, there is a locked door in one room and a key in another. When you find the key and click it the door will be unlocked and you will be able to progress further within the maze.

The exact error is "TypeError: Error #1009: Cannot access a property or method of a null object reference."

My code is.... ("gKey" is in the current frame while "A25" and "gLock" are in another frame)

  1. gKey.addEventListener(MouseEvent.CLICK, GreenUnlock);

Function GreenUnlock(m:MouseEvent)

{

    A25.addEventListener(MouseEvent.CLICK, hop25);

    gLock.visible = false

}

function hop25(m:MouseEvent)

{

    gotoAndStop(13);

}

TOPICS
ActionScript
319
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 05, 2013 Mar 05, 2013

The short answer is most likely that you cannot try to execute code for an object that does not exist in the frame where the code executes.  You will need to either move the object to where the code is or move the code to where the object is.

Translate
LEGEND ,
Mar 05, 2013 Mar 05, 2013
LATEST

The short answer is most likely that you cannot try to execute code for an object that does not exist in the frame where the code executes.  You will need to either move the object to where the code is or move the code to where the object is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines