As3 Error Classes Must Not 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 Error 1131: Classes Must Not Be Nested up vote 1 down vote favorite I'm using Flash CS4 Professional to build a draggable element. However, whenever I input my code, I get error 1131. Can somebody please tell me what I'm doing wrong? stop(); class Scrollbar extends Sprite { var value:Number; var padding:Number = 5; var _textField:TextField; var max:Number; var min:Number; function draggable() { min = bar_mc.y; max = bar_mc.height - Erhu_H3_btn.height; Erhu_H3_btn.addEventListener(MouseEvent.MOUSE_DOWN, dragHandle); } function dragHandle(event:MouseEvent):void { Erhu_H3_btn.startDrag(false, new Rectangle(0,min,0,max)); stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging); } function stopDragging(event:MouseEvent):void { Erhu_H3_btn.stopDrag(); stage.removeEventListener(MouseEvent.MOUSE_UP, stopDragging); } } actionscript-3 class flash-cs4 nested share|improve this question asked Sep 21 '14 at 7:45 15leungjs1 156 Where you put this code? in the timeline? –null.point3r Sep 21 '14 at 7:52 Yes. It's on a separate layer. –15leungjs1 Sep 21 '14 at 7:55 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted You should put the codes of Scrollbar class in a separate .as file and then you can declare an instance like this: import PackageName.Scrollbar; stop(); var scrollbar:Scrollbar = new Scrollbar(); Scrollbar class located in "PackageName\Scrollbar.as": package PackageName{ import flash.display.Sprite; public class Scrollbar extends Sprite{ var value:Number; //... } } share|improve this answer edited Sep 21 '14 at 16:05 answered Sep 21 '14 at 8:01 null.point3r 9162716 Does that mean I have to put that code on a separate file for it to work? If that is the case, can I do that if my file is not a project? –15leungjs1 Sep 21 '14
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 correctly without it enabled. Please turn JavaScript back on and reload this 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 4 Replies Latest reply on Jul 24, 2008 10:15 AM by MikeSDCA http://stackoverflow.com/questions/25957013/error-1131-classes-must-not-be-nested Classes must not be nested?? sneakyimp Feb 20, 2008 7:53 PM I created a new Flash file (Actionscript 3) and typed this code on the first frame on the movie: class TestClass1 extends Object { public function identify() { trace('i am class one'); } } var obj:Object; obj = new TestClass1(); obj.identify(); I get this error: 1131: https://forums.adobe.com/thread/106106 Classes must not be nested. What is going on? 3107Views Tags: none (add) This content has been marked as final. Show 4 replies 1. Classes must not be nested?? _forumSteve Feb 21, 2008 7:50 AM (in response to sneakyimp) On publish, the compiler creates a class called MainTimeline for all of the code in frames. By creating a class in a frame, it is being nested inside the MainTimeline class... thus, producing the error. Like Show 0 Likes(0) Actions 2. Re: Classes must not be nested?? sneakyimp Feb 22, 2008 3:28 PM (in response to sneakyimp) Thanks! Like Show 0 Likes(0) Actions 3. Re: Classes must not be nested?? Guest Jul 24, 2008 10:02 AM (in response to _forumSteve) Getting this error message as well. What's the best way to solve this? Like Show 0 Likes(0) Actions 4. Re: Classes must not be nested?? MikeSDCA Jul 24, 2008 10:15 AM (in response to sneakyimp) Put your classes in a namespace inside .as files. Like Show 0 Likes(0) Actions Go to origin
times are UTC Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group. Designed by ST Software for PTF.
today. But don't worry: in 10 years from now it WILL look completely different :) Saturday, November 8, 2008 "Classes must not be nested" error If you ever come across the "classes must not be nested" error (and/or the "internal build" error) then you're in trouble :) There are different possible causes for these errors. In my case it was because I was referring to a none existing component from within an itemRenderer. A good list with a number of potential causes can be found on http://rjowen.wordpress.com/2007/06/21/internal-build-error-or-classes-must-not-be-nested-error/. Posted by Ria Flex at 14:40 No comments: Post a Comment Newer Post Older Post Home Blog Archive ► 2011 (1) ► March (1) ► 2010 (2) ► April (1) ► February (1) ► 2009 (7) ► October (1) ► August (1) ► June (1) ► February (1) ► January (3) ▼ 2008 (18) ► December (3) ▼ November (3) Focus in all cases Discount code for Adobe Max in Milan "Classes must not be nested" error ► September (1) ► August (1) ► June (2) ► May (2) ► April (1) ► February (1) ► January (4) ► 2007 (10) ► November (1) ► September (1) ► July (1) ► June (1) ► May (2) ► March (4) About Me Ria Flex What do you want to know? View my complete profile