Actionscript: TypeError: Error #1009 - actionscript-3

I have been trying to fix an error in my project for the past hour, and I really have no idea what the cause is. I will post the code on my skydrive:
https://skydrive.live.com/embed?cid=9AB08B59DCCDF9C6&resid=9AB08B59DCCDF9C6%21108&authkey=AGVkp5KnQLMYu7M
Everything just doesn't work the way I want to. The inventoryrelationships_btn is glitchy when I test the movie. To make it worse, when I debug, and the inventory/relationships button is clicked, it freezes up everything.

The culprit comes from the following line
menuback_btn.addEventListener(MouseEvent.CLICK, menubackClick);
in your "popups" symbol, frame 2. There is no menuback_btn, and if you do a trace(menuback_btn); The output window shows null.
Hope this helps.

Related

I am trying to create a button that traces when it gets clicked in ActionScript 3, why am I getting error 1046?

I'm trying to make a game for a school assignment and I'm trying to make a button that, for now, will just trace that it has been clicked. However, anytime I try to run it it says "1046: Type was not found or was not a compile-time constant: MouseEvent." Here is the code:
Image of part of the code
(apparently I can't embed an image so I hope this works...)
This is in the button's code, not the stage.
I've tried figuring it out and looking up how to solve this however can't find the answer. I'm not sure what the cause is or how to solve it. Can anyone help me?

Actionscript ExternalInterface syntax error

I have created a simple container app whose purpose is to:
play an embedded flv by clicking a button onscreen
activate an external interface call (this records the fact that the person has watched the video)
That's it.
I have it working partially. I have a button on scene 1 with the "click and go to next scene" code snippet attached to it. I click it and it happily moves on to scene 2 where the flv video plays beautifully. The problem happens when I try to insert the code that the external developer told me to use to make the connection between my flash file and IT's back end work.
Here is the recommended code:
ExternalInterface.call("recordScore()”);
Unfortunately, as soon as I enter this code, there is a syntax error and the movie no longer plays. I added the code on a frame at the end of the movie.
I am no sure that the syntax the developer sent was correct, nor do I know where to insert this code into the proper place.
It looks like there is a closed double quotes (”) in what you pasted:
ExternalInterface.call("recordScore()”);
Assure quotation marks, and you do not need the () on the JavaScript function you're calling:
ExternalInterface.call("recordScore");
When running from Flash Projector (as in Ctrl+Enter), you can test whether External Interface is available; otherwise, an exception is thrown at runtime:
if (ExternalInterface.available) {
ExternalInterface.call("recordScore");
}
Fortunately, I found some code in the former employee's files that seems to have worked:
ExternalInterface.call
(
"recordScore()"
);
Hopefully this will connect with the database and resolve the issue so I can go back to making videos.
Thank you so much for your help!
Regards!

ArgumentError: Error #2109: Frame label default not found in scene default

I have asked this question on the http://www.actionscript.org/ forums, I have yet to get a reply, so I will try here as well, I will copy the post from those forums, but please do tell me if I am missing any details out, posting it on the wrong forum on this website, or whether I should actually post it to another website.
The post is as follows:
I am fairly new to using action script 3.0, I am following a set of video tutorials for such.
I am using Adobe Flash Professional CC 2014, along with some extra elements, to create the main menu for a game using UDK(Unreal Development Kit), that I have in mind, to confirm, this is a test game, not intended for release, it will be free to try when I get various features implemented, a practice project.
So, I am using Scaleform and CLIK. When I run what I have so far, using the Scaleform launcher, everything works as intended, no errors are logged in the console. However, when I use the debugger and click on the 'Options' button on my main menu (it is the only button in frames 1-10, at the moment, under the 'mainMenuScreen' label that I have declared), I get the following error:
ArgumentError: Error #2109: Frame label default not found in scene default.
at flash.display::MovieClip/gotoAndPlay()
at scaleform.clik.controls::Slider/draw()[C:\UDK\UDK-2014-08\Development\Flash\AS3\CLIK\scaleform\clik\contr ols\Slider.as:273]
at scaleform.clik.controls::Slider/set value()[C:\UDK\UDK-2014-08\Development\Flash\AS3\CLIK\scaleform\clik\contr ols\Slider.as:156]
at MainMenu_fla::MainTimeline/frame10()[MainMenu_fla.MainTimeline::frame10:11]
at flash.display::MovieClip/gotoAndPlay()
at MainMenu_fla::MainTimeline/OpenGameplayOptionsScreen()[MainMenu_fla.MainTimeline::frame1:17]
I am not using a label known as 'default', nor do I have a scene called 'default' and also, as can be seen from the code for the button, I am not trying to go to (gotoAndPlay), 'default', I am trying to go to a label I have defined, known as 'gameplayOptionsScreen', the code is as follows:
import flash.events.MouseEvent;
/*Function
#Name: OpenGamePlayOptionsScreen
#Params: None
#Description: This function will make the scene go to the "gameplayOptionsScreen"
label, so that the components that will be on the screen will now be those under the
label of "gameplayOptionsScreen".
*/
function OpenGameplayOptionsScreen(evt : MouseEvent)
{
gotoAndPlay("gameplayOptionsScreen");
}
// Add an event listener to this button, so it can tell if it has been clicked on, // in this case:
optionsBtn.addEventListener("click", OpenGameplayOptionsScreen);
(The line above this one, is where the debugger highlights one of the places the error occurs)
stop(); // Stop the flash movie here
From what problems that the debugger has informed me of, it also seems to have a problem with the slider that appears in frame 10, the frame that the label, 'gameplayOptionsScreen', is assigned too.
But I am wondering why the error occurs, in regards to a call to 'gotoAndPlay("gameplayOptionsScreen");', as that is where I believe the error becomes existent from.
Please do tell me if you require more information to help me solve this problem that I am having, or do tell me if I have posted this in the wrong forum on this website, or if I have in fact posted this to the wrong website altogether and therefore, should be posting to Epic Games' forums instead.
Edit: I have redone the button, so that, it is now known as TestGameButton and DefaultButton is in my library too, as it was in the click components library, this component has been left unchanged this time. Using my new button still produces the same errors and even using the default button does as well. But removing the slider that the debugger also complains about that is displayed in frame 10, removes all the errors, so it seems to be a problem with the slider, I am not sure what though, I have tried putting in a new instance and naming it, but I get similar errors .
Never mind then, I don't mind if this question does not get any answers, I am moving onto UE4, which has much better systems in place for menus, for example, thanks for trying to help #CyanAngel though.

Error #1009 when the first choice is clicked (but working with the 2nd and 3rd choice)

Ok ive googled about this error and still cant fix my problem.
it was all going well. Im just copying the same codes and changing variable names for the first frame since the 3 frames basically has the same functions. But when i copied it to the first frame, i get that error.
Fla file: https://www.dropbox.com/s/domsbipbxwmyoje/100%20-%20Copy.rar
stop();
small.addEventListener(MouseEvent.CLICK,play1);
function play1(event:MouseEvent):void{
gotoAndStop("3");
}
medium.addEventListener(MouseEvent.CLICK,play2);
function play2(event:MouseEvent):void{
gotoAndStop("4");
}
large.addEventListener(MouseEvent.CLICK,play3);
function play3(event:MouseEvent):void{
gotoAndStop("5");
}
Thats the code for the first frame. Thats just a part of the code and not the whole. I feel like the error is in there. The medium and large are perfectly fine. i carbon copied the codes to the SMALL option but i get an error. I feel like i dont need to post the code for the frame 3 (where the error is happening) since its just the same with MEDIUM and LARGE.
You have to change the name of your button next_btn1 is called in the script but the name on the timeline is next_btn.
Instead of running the movie (ctrl+enter) you can debug the movie (ctrl+shift+enter) try it it will change your life ;)

Adobe flash can't run code in a frame

Ok, I'm fairly new to Flash, and I was trying to code some ActionScript now for the last two days. I can't a simple piece of code to work:
stop();
So... pretty simple right? ;)
I have a 10 frame animation, and I'm trying to make the animation stop at frame 5. So I select frame 5 from my timeline and then I open the action menu and I simply write stop(); in the window. When I run it I get the following error message:
In ActionScript 3.0 code cannot be placed directly on objects. Please select an object or use the Code Snippet panel to apply code to the current selection on stage.
I totally understand this is a simple question and the answer might be obvious, but I can't find it...
Thanks
EDIT:
I tried debugging it, and it works when in the debugger but not when in flash...
You're putting the code "on" the object, not allowed in AS3 (thx god).
To avoid it, create a new layer and name it "code" (or whatever you want), and put the code in it