Adobe Flash Error 1037
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 ActionScript 3 Error 1037: Packages cannot be nested up vote 0 down vote favorite I am new to AS3. When learning AS3, I get the below code from an Adobe example and trying to run it gives an error like "1037: Packages cannot be nested." What does this mean? Please tell me how to execute? or any problem in this code? package { import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFieldType; public class TextField_alwaysShowSelection extends Sprite { public function TextField_alwaysShowSelection() { var label1:TextField = createTextField(0, 20, 200, 20); label1.text = "This text is selected."; label1.setSelection(0, 9); label1.alwaysShowSelection = true; var label2:TextField = createTextField(0, 50, 200, 20); label2.text = "Drag to select some of this text."; } private function createTextField(x:Number, y:Number, width:Number, height:Number):TextField { var result:TextField = new TextField(); result.x = x; result.y = y; result.width = width; result.height = height; addChild(result); return result; } } } actionscript-3 share|improve this question edited Jul 11 '11 at 2:40 phwd 17.8k43664 asked Feb 13 '09 at 8:04 naveen 52651224 add a comment| 5 Answers 5 active oldest votes up vote 1 down vote accepted Your code should compile, provided that it is in the root source folder ("src" in flex builder). Are you sure that's the entire file? The error means that you have nested a package {} statement inside another package {} statement. share|improve this answer answered Feb 13 '09 at 8:17 Richard Szalay 54.4k14126178 add a comment| up vote 2 down vote You need to create an action script file and then add that class to document class in your fla file property then it would not give you an error share|improve this answer answered Nov 18 '11 at 19:28 Sraven Kumar Kande 212 add a comment| up vote 1 down vote If you want to include the AS3 in the timeline itself, use this: import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFieldType; function TextField_alwaysShowSelection() { var label1:TextField = createTe
how my code is wrong, it is verbatim from the flash help http://stackoverflow.com/questions/545124/actionscript-3-error-1037-packages-cannot-be-nested at Adobe with the exception of my minor customizations. Any help is greatly appreciated just trying to make a simple contact form - https://www.sitepoint.com/community/t/as3-error-1037-nested-package-help/56809 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
MX Player Adaway ViPER4Android Audio FX Official XDA App All Apps & Games XDA Assist ANALYSIS Editorials & Opinion Analysis http://forum.xda-developers.com/showthread.php?t=2578824 Mediatek Officially Unveils the 10 nm Helio X30 and 16 nm Helio https://www.kirupa.com/forum/showthread.php?292777-1037-packages-cannot-be-nested P25Android Gaming Graphics at a Standstill: What Is Holding Us Back, and the Path ForwardBetrayal of Hype: Playing Fast and Loose with Release Dates Breeds Consumer MistrustHow Allo and Duo Want to Complicate Messaging by Fracturing the MarketAllo’s Shortcomings Seriously Limit Adoption and Potential in a Competitive adobe flash Market Opinion Android Gaming Graphics at a Standstill: What Is Holding Us Back, and the Path ForwardBetrayal of Hype: Playing Fast and Loose with Release Dates Breeds Consumer MistrustHow Allo and Duo Want to Complicate Messaging by Fracturing the MarketAllo’s Shortcomings Seriously Limit Adoption and Potential in a Competitive MarketOpinion: Experiencing Both Note 7 Variants Convinced Me, the adobe flash error next Galaxy Should Be Exynos-Only Developments More than a Meme: Google uses TheVerge.com to Benchmark Nexus DevicesMoto Z Receives Official TWRP SupportMozilla is Removing Firefox OS code from the Gecko EngineSuperSU Privacy Policy Updated Under CCMTCode Names Revealed for Unreleased HTC Devices Discuss What Features Do You Want on Google Apps on Android?Compilation: OnePlus September Software Edition AMAHow Important are Water/Dust Resistance and General Phone Durability to You?What Are Your Thoughts on Google Allo?What Lifehacks Do You Use When Travelling As a Developer or Enthusiast? Xda news More than a Meme: Google uses TheVerge.com to Benchmark Nexus DevicesNew Android Wear 2.0 Preview with Smart Replies, Watch App Store — Main Release Delayed until 2017What Features Do You Want on Google Apps on Android?Samsung is Waiting to See How the VR Market DevelopsFreedomOS Revisited LOGIN Jump back in Remember Me? Forgot your password? REGISTER Takes just a sec! search plus search plus Forums Honor 8BLU R1 HDSamsung Galaxy Note 7OnePlus 3ZTE Axon 7 Analysis More than a Meme: Google uses TheVerge.com to Benchmark Nexus De
using your existing account on the new forums, check out this thread. Register Help Remember Me? Forum Today's Posts FAQ Calendar Forum Actions Mark Forums Read Quick Links View Forum Leaders What's New? Advanced Search Forum Flash Flash IDE 1037: packages cannot be nested Results 1 to 2 of 2 Thread: 1037: packages cannot be nested Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode March 25th, 2008,01:00 AM #1 Evan70 View Profile View Forum Posts 3 posts Registered User 1037: packages cannot be nested I am using Flash cs3 with AS 3.0 and trying to experiment with code given in the "Actionscript 3.0 Cookbook" I apply the script to a keyframe in layer1 where I would place my scripts, The error I am getting is 1037: packages cannot be nested I have gone over it again and again, and can't figure out what I am doing wrong. I even tried just saving it as an ".as" file then in the upper right hand corner "targeted it" to a .fla file. Nothing. I think I'm either not applying the code right or putting it in the right place or else I need to alter the code somehow. Has anyone else used this book or run into this problem? This is the code: package{ import flash.display.Sprite; import flash.events.Event; public class Velocity extends Sprite { private var _sprite:Sprite; private var _vx:Number = 3; public function Velocity () { _sprite =new Sprite(); _sprite.graphics.beginFill(0x0000ff, 100); _sprite.graphics.drawCircle(0, 0, 25); _sprite.graphics.endFill(); _sprite.x =50; _sprite.y =100; addChild (_sprite); addEventListener(Event.ENTER_FRAME, onEnterFrame); } public function onEnterFrame(event:Event):void{ _sprite.x += _vx; } } } Any Ideas would be greatly appreciated! Reply With Quote March 25th, 2008,11:06 PM #2 icio View Profile View Forum Posts Visit Homepage 3,811 posts looks better in lowercase You cannot put a package or class on a keyframe. Class definitions (for example MyClass) should be within a file named "MyClass.as". You can read more on package and class definitions