As3 Error Package Cannot Be Nested
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What does “Packages cannot be nested” in AS3 mean? up vote 0 down vote favorite I got the complie error "Packages cannot be nested". What does it mean, and how do I fix it? actionscript-3 flash nested package share|improve this question asked Dec 19 '13 at 20:18 user3040958 125 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote While you can have more than one Class, you should only have a single Package in each of your .as files. Check your .as files to see if you have more than one instance of Package. Update based on OP's comments: You cannot use Packages or Classes on the timeline. You need to place that code in an external file and link to it either by making it your Document Class or by assigning it to a symbol in your library via the Class property in the properties panel. share|improve this answer edited Dec 21 '13 at 20:11 answered Dec 19 '13 at 21:11 Marcela 3,5231819 There was only one. I added the script directly to the file instead of importing/including. –user3040958 Dec 20 '13 at 17:06 What do you mean when you say you "added the script directly to the file"? Do you mean that you copied/pasted code? If so, it's possible that the file you created (depending on the IDE you're using) automatically created a package for you and when you pasted the code you added a second package. –Marcela Dec 21 '13 at 0:19 Yes, I copy pasted the code into the fla file. So now the code is in frame 1 of the mainscreen. –user3040958 Dec 21 '13 at 12:48 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged actionscript-3 flash nested package or ask your own question. asked 2 years ago viewed 1186 times active 2 years ago Related 0package error in as30How to get the Android developer classes (packages) in my AS3 project0AS3 core packages reference2What does factoryCl
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Packages cannot be nested an error in flash cs6 up vote 0 down vote favorite It's my first time coding in flash, I am creating a login form wherein when user login in flash the http://stackoverflow.com/questions/20690888/what-does-packages-cannot-be-nested-in-as3-mean record will automatically stored in the database. I am currently testing the button submit, but there was an error saying "packages cannot be nested". Hope you could help me. package actions { import flash.display.MovieClip; import flash.events.*; public class main extends MovieClip { public function main ():void { submit_button.buttonMode = true; submit_button.addEventListener(MouseEvent.MOUSE_DOWN, checkLogin); username.text = ""; password.text = ""; } public function checkLogin (e:MouseEvent):void { trace("submission success"); } } } actionscript-3 flash share|improve this question edited Jun 15 '15 at 12:00 http://stackoverflow.com/questions/30843681/packages-cannot-be-nested-an-error-in-flash-cs6 Vesper 14.8k22047 asked Jun 15 '15 at 11:11 LEE 205 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote accepted "Packages cannot be nested" means that you have an AS file that literally includes two blocks marked package. An example of nesting: package a { ... package b { .... } } You need to revise your code so that no file contains nested package blocks. This isn't an error in programming, but rather a markup error (that potentially hides a lot of uneven braces or other types of copy&paste mixups). UPDATE: A timeline code is declared as being inside a package, so if you are trying to add a package ...{...} block to a timeline, you will get this very error. share|improve this answer edited Jun 15 '15 at 12:32 answered Jun 15 '15 at 11:23 Vesper 14.8k22047 package actions { import flash.display.MovieClip; public class main extends MovieClip { public function main():void { trace("success"); } } } this is the code for my as file.It was not nested. –LEE Jun 15 '15 at 11:31 There shold be dependent files, check them. Probably your stage contains another AS-linked class instance, and that file has a nested packages issue. You need to review your codebase, not just one file. –Vesper Jun 15 '15 at 11:35 Yes i have a dependent file, i've checked it already and there was only
ElementsAdobe Dreamweaver Adobe MuseAdobe Animate CCAdobe Premiere ProAdobe After EffectsAdobe IllustratorAdobe InDesignView all communitiesExplore Menu beginsMeet the expertsLearn our productsConnect with your peersError: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work https://forums.adobe.com/thread/129428 correctly without it enabled. Please turn JavaScript back on and reload this https://www.sitepoint.com/community/t/as3-error-1037-nested-package-help/56809 page. Please enter a title. You can not post a blank message. Please type your message and try again. More discussions in ActionScript 3 All CommunitiesAdobe Animate CC - HomeActionScript 3 2 Replies Latest reply on Jan 7, 2008 12:42 PM by Newsgroup_User 1037: Package Cannot Be Nested as3 error Newsgroup_User Jan 7, 2008 10:30 AM Hi -- I ran in to the "1037: Package Cannot Be Nested" error when using the sample code in Flash help and found the "How to Use the Examples" portion of the Adobe Flash help files to finally get my answer. It appears to be an issue many others have come across so I thought as3 error package I would explain in more detail how to solve this problem. What you need to do is save the ActionScript file as the name of the class, for example "MyClass." Then you set the Flash movie "Document Class" (FILE-->PUBLISH SETTINGS-->FLASH-->SETTINGS) to "MyClass." You do not need to call/refer to/load the ActionScript file in the Flash movie -- it will do it automatically for you! Just make sure the FLA and the AS file are both in the same directory. Rich 2695Views Tags: none (add) This content has been marked as final. Show 2 replies 1. Re: Package Cannot Be Nested Newsgroup_User Jan 7, 2008 12:29 PM (in response to Newsgroup_User) Richard, > I ran in to the "1037: Package Cannot Be Nested" error when > using the sample code in Flash help Ah, good one! Yes, thanks for bringing this up. A number of the current 3rd party ActionScript books -- and, as you pointed out, most of the sample code in the docs -- is written in the form of class files. I've heard from a number of
how my code is wrong, it is verbatim from the flash help at Adobe with the exception of my minor customizations. Any help is greatly appreciated just trying to make a simple contact form - AS3 to PHP: package { import flash.display.Sprite; import flash.net.navigateToURL; import flash.net.URLRequest; import flash.net.URLVariables; public class sendForm extends Sprite { public function sendForm(event:MouseEvent):void { var url:String="formSend.php"; var request:URLRequest=new URLRequest(url); var variables:URLVariables = new URLVariables(); variables.usrName=name_txt.text; variables.usrEmail=email_txt.text; variables.usrMsg=msg_txt.text; request.data=variables; navigateToURL(request); trace(usrName, usrEmail, usrMsg); } } }submit_btn.addEventListener(MouseEvent.CLICK, sendForm); Home Categories FAQ/Guidelines Terms of Service Privacy Policy Powered by Discourse, best viewed with JavaScript enabled Shop Versioning Reference Articles Premium