Packages cannot be nested
I'm a newbie and have started a simple tabbed mobile project.
I keep getting "packages cannot be nested".
my main mxml file:
<?xml version="1.0" encoding="utf-8"?>
<s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script source="cBut/cFields.as">
</fx:Script>
<s:ViewNavigator label="Results" width="100%" height="100%" firstView="views.ResultsView"/>
<s:ViewNavigator label="Setup" width="100%" height="100%" firstView="views.SetupView"/>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:TabbedViewNavigatorApplication>
my .as file:
package
public class cFields
public function cFields()
what am I doing wrong?
thanks
The <fx:Script source="cBut/cFields.as"> tag will insert your cFields.as file into the MXML file (similar to an include in C/C++). That will cause an invalid syntax, as you've noticed.
Give your package a name (in this case it should be called cBut because that is the name of the folder it is in) then use the import statement inside your script tag. Make sure you adhere to the recommended file, namespace, package and class naming structure. That's usually a reverse-DNS style: com.adobe.utils.bla.bla.bla.
If you package name is blank and the source is in the default folder, you don't need to import it.
Look up the package keyword in the help.
Similar Messages
-
Error: Packages cannot be nested
i have the following AS class file:
package {
public class DropImage {
public function DropImage() {
package{
import flash.display.MovieClip;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import com.greensock.TweenNano;
import com.greensock.easing.*;
public class DropImage extends MovieClip {
private var containerArray:Array = new Array ;
private var totalImgs:int = -1;
private var counter:uint = 0;
private var imageLength:uint;
public function DropImage() {
//Loads the xml
var xmlLoader:URLLoader = new URLLoader ;
xmlLoader.load(new URLRequest("DropImages.xml"));
xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
//Creates new instances of the ImageContainer class with the y position
//initally set off the stage and the rotation at -90. The -90 rotation
//gives the dropping effect as the object gets tweened downwards.
private function xmlLoaded(e:Event):void {
var xml:XML = new XML(e.target.data);
imageLength = xml.image.length();
for (var i:int = 0; i < xml.image.length(); i++) {
var imgc:ImageContainer = new ImageContainer(xml.image[i].attribute("src"));
imgc.x = 100;
imgc.y = -133;
imgc.rotation = -90;
imgc.alpha = 0;
imgc.addEventListener("imageloaded",showImage);
addChild(imgc);
containerArray.push(imgc);
//waits for all images before tweening
private function showImage(e:Event):void {
totalImgs++;
if (totalImgs == imageLength - 1) {
tweenBox();
//tweens the images downwards to a randoms rotation between -11 and 11
//and replays the tween after two seconds.
private function tweenBox():void {
TweenNano.to(containerArray[counter],1, {y:192.45,
rotation:Math.floor(Math.random() * 11) - 11,
alpha:1,
ease:Sine.easeOut,
onComplete:function(){
if(counter != containerArray.length - 1){
counter++;
TweenNano.delayedCall(2, tweenBox);
It sais '1037: Packages cannot be nested' and if i click the error it goes to line 7 of the scrip..help please? 3as3 Class files all follow the same general format listed below.
package designation
import statements
the class declaration
class-scoped (ie, not local to a function) variable declarations
the class constructor
other class functions
p.s. that's as3, not as1,as2.
p.p.s. format your code so it's legible. -
"Packages cannot be nested" error in Flex
I want to use SoundFacade class from Adobe. (Here, from github). I simple created an "ActionScript File" and paste all the code. But when I want to compile my app I got following error:
1037: Packages cannot be nested.
The only reason I can guess is that the package must somehow put into the project or something.
Even when I just put a simple empty package I got the error:
package { }
Any idea what is this error about?Found the solution in the forum: http://forums.adobe.com/message/4299377
-
Error -- 1037: Packages cannot be nested.
Hi There,
I am using Flash CS3 and ActionScript3.0 for development. I
am trying to run some sample codes from Adobe site [and also from
Flash Help, copied directly] but on compiling it throws "1037:
Packages cannot be nested.". I m totally clueless... my only
assumption is... this might be a Flash/Environment setting issue.
Even if it is an Env issue... how to resolve it? Any help!!
Thanks in Advance,
Siraj Khan
[email protected]
// Code AttachedThe example code in the online help is horribly inconsistent.
The example that you site is meant to be pasted into an .as
external file. If you want to use this code in an actionscript
frame space then you'll have to de-package the code. Look at my
example. You have to remove the package wrapper and the sprite
extension wrapper. Then remove the "Public" and "private" prefixes
from the functions. Finally you have to call the first
function. -
Packages cannot be nested : 1037 Error!!
Hi There,
I have this problem with CS3, and I dont know if there are
any settings and stuff. When I do something like the code attached
I get "1037: packages cannot be nested". If I remove the package
and the braces, i get "classes cannot be nested", but sometimes the
Adobe Flash Class help Examples work. When I create a class and
package, this problem occurs. its quite wierd. And Im not a CS3
Enthusiast yet, so please forgive me if its some silly mistake
somewhere.This belongs in an external .as file, not anywhere on the
timeline. -
AS3 in Flex - ERROR 1037 Packages cannot be nested
Hi.
I am having some difficulty getting this simple bit of code
working in Flex. It works perfectly in Flash. However in Flex i get
an error 1037, Packages cannot be nested. Can anyone let me know
where im going wrong / how to fix this problem. Thanks. Code
attached.
Barry.This thread should be in the AIR forum. The couple
suggestions Andrei1 is making are correct, but it isn't the reason
why you're getting that error.
When you want to use a class within the declarative
environment of Flex/AIR, you should use a namespace for that class
and instantiate it via MXML or instantiate it within the Script
block via ActionScript. Make sure that the files are in the same
folder and then see if the following works for you.
TS -
1037: Package Cannot Be Nested
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 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.
RichRichard,
> 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 people who have tried to copy/paste
such code into
keyframes, then see the 1037 compiler error.
In ActionScript 3.0, all SWFs have a Document class one way
or the
other. If you don't assign one yourself, such as the
MyClass.as you
mentioned, the SWF will receive a default Document class by
the name of
MainTimeline. Which means the SWF's code is already declared
inside a
package (automatically). The introduction of a second
(seemingly original)
package declaration in timeline code cause those two packages
to be nested,
which is not allowed.
David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design." -
1037: Packages cannot be nested.
Hi
I want to create a package but it is popping me captioned error. I am clueless what is happening.
any help is highly appriciated.
<code>
package scripts.customScripts{
class test{
</code>
thanks in advance.
VarunProvide code snippets where you are declaring packages and
classes.
However as a wild guess you have the package statement on the
timeline of a Flash movie. -
Package Cannot Be Nested 1037 & Syntax Error 1084
Trying to learn how to crerate a Box2D game in WIndows 8 Flash Pro CC. Opened new document in ActionScript 3.0 Class or ".as" as a Flash Pro application. Very very new to all developer languages and processes. Please help.
package {
import flash.display.Sprite
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class Main extends Sprite{
public function Main(){
trace(*my awsome game starts here *);the default directory is usually in the same directory where the main fla is saved but that can be changed in advanced actionscript settings panel (file>publish settings>actionscript settings - wrench icon).
p.s. you should copy and paste your actualy code. if that is your actual code, that trace is incorrect and should contain a string. ie, change the asterisks to quotes. -
Installer Package cannot not be opened (999)
I cannot get iLife '06 or iPhoto '06 installed.
No matter what I do I get this error:
"The Installer Package cannot not be opened.
There was an unknown error with the package (999)"The DVD may be damaged.
Return it for an exchange. -
Hi,
The following query is showing error An INSERT EXEC statement cannot be nested
CREATE PROCEDURE [dbo].[Procedur3]
@para1 int
AS
BEGIN
CREATE TABLE #tem
select * from detialpar where did=@para1
--this code is quite big and is called from many place so we kept it inside this SP , so that we can call the sp to get result.
END
CREATE PROCEDURE [dbo].[Procedur2]
@para1 int
@para2 datetime
AS
BEGIN
CREATE TABLE #tem
insert into #tem (value) exec [dbo].[Procedure3] @para1
exec ('select * from abc
left join #tem on id=temid
where id =' + cast(@para1 as varchar) -- i do not want to change this big dynamic query, because it has many optonal code concatinated by using "if then else".
END
CREATE PROCEDURE [dbo].[Procedure1]
@para1 int,
@para2 datetime
AS
BEGIN
delete from table1 where id=@para1
insert into table1 ( col1,col2) exec Procedure2 @para1,@para2
……. There are many blocks in this SP where we are deleting and inserting with different SP .
select Name,Amount from #Temp1
END
CREATE PROC Procedure
AS
BEGIN
SET TRANSACTION ISOLATION LEVEL SNAPSHOT
SET NOCOUNT ON
LOOP "A" starts here which gests id from a table xyz @para1
begin try
begin trans
exec [Procedure1] @para1
LOOP "A" ents here
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
IF @@trancount > 0 ROLLBACK TRANSACTION;
END CATCH;
END
GO
Please tel me some good way of solving the error.
yours sincerlyYou can not do like above:
Try the below:(Not tested), Below, we do not change the code, however, we placed your dynamic execution to different procedure.
CREATE PROCEDURE [dbo].[Procedur3]
@para1 int
AS
BEGIN
CREATE TABLE #tem
insert into #tem (value)
select * from detialpar where did=@para1
--this code is quite big and is called from many place so we kept it inside this SP , so that we can call the sp to get result.
END
CREATE PROCEDURE [dbo].[Procedur2]
@para1 int
@para2 datetime
AS
BEGIN
CREATE TABLE #tem
exec [dbo].[Procedure3] @para1
END
CREATE PROCEDURE [dbo].[Procedure1]
@para1 int,
@para2 datetime
AS
BEGIN
delete from table1 where id=@para1
insert into table1 ( col1,col2)
exec ('select * from abc
left join #tem on id=temid
where id =' + cast(@para1 as varchar) -- i do not want to change this big dynamic query, because it has many optonal code concatinated by using "if then else".
……. There are many blocks in this SP where we are deleting and inserting
with different SP .
select Name,Amount from #Temp1
END
CREATE PROC Procedure
AS
BEGIN
SET TRANSACTION ISOLATION LEVEL SNAPSHOT
SET NOCOUNT ON
LOOP "A" starts here which gests id from a table xyz @para1
begin try
begin trans
exec [Procedure1] @para1
LOOP "A" ents here
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
IF @@trancount > 0 ROLLBACK TRANSACTION;
END CATCH;
END
GO -
"XMLDOM package cannot be found"
I get the following message while trying to set up the design repository under Oracle 9i Enterprise 9.2.0.1.0 (Unix)
OWB version is 9.0.4.8.21 (Running from Windows)
"lineage and impact analysis won't work if user continues this installation since XMLDOM package cannot be found under this user"
I did not have this problem installing Oracle 9i Enterprise 9.1.??? (Windows) at home with the same OWB version..
please help !Oracle XML toolkit is required in database to run lineage and impact analysis. It's under Oracle 9i Development Kit node in the components tree when you run Universal Installer.
Note that this is documented in "OWB Install Guide", section 1.2.2.1 where it states "Install the Oracle9i database with the Oracle XML Toolkit option."
Nikolai -
Message : Event package cannot be changed; bookings already
When i tried to offering event using i got following message : T-code : PIQACADOFFER0
"Event package cannot be changed; bookings already exist" Message no. HRPIQ00OFFER109
Event is not created for this event package and i wander this is new function in EP3 that i have to override
or just program error.
regards,
jin dalJin dal,
System is using view table V_PIQMODBOOKED to check no of booking.
Check is there any active booking record exists for that event package? Which make sense because first you build event plan (event and event package) then you allow students to book.
Prabhat Singh -
Flash CS3 fl.* package cannot be used in Flex Builder 3
Hi,
I was very disappointed to find out that one cannot import
the fl.* package, which is available for flash CS3. I found a work
around by creating swc file and importing them, however it's
disappointing that flash CS3 would have such a major advantage over
Flex Builder 3 when building an Action Script 3.0 Application.
Best, EI've looked over that sample.
Part of the problem is that I don't have access to
mx.effects. I think this is because that example is a Flex 3
Project and has a MXML file attributed to it. I opened a Flex 3
project and was able to access mx.effects - but my project is
different in that it's an ActionScript project - meaning, I opened
an ActionScript project in Flex Builder 3. Apperantly the
ActionScript projects don't have access to mx.effects.Tween. And
niether do they have access to fl.transitions.Tween. It's strange -
and I'm trying to find a way to access them by connecting the build
path to the Tween classes somehow.
My project preferences already have the fl.* folders in the
build path. It just still doesn't seem to work. -
Ojects from Package cannot be transported
Hello,
When I try and release a transport request, I get the following message.
Objects in package ZXI cannot be edited in transportable Workbench requests in the current system DXA. The transport routes are configured such that objects from package ZXI can only be edited in local Workbench requests.
the configuration of the transport routes must be corrected in the Transport Management System (TMS).
Kindly help me add this package to the transport routes.
Currently the Transport layer in STMS has name ZDXA.
Please advise.
Thanks.While creating a package you have to specify teh transport layer.
Maybe you are looking for
-
System Settings Reset After External Drive is Shut Down
I have my System Settings set to have the Autosave Vault, Thumbnail Cache and Waveform Cache live on my external media drive, not my internal boot drive. However, every time I turn off my media drives, the program resets these folders onto my boot dr
-
Using Jabra EASYCALL Bluetooth headset, but connection is working unreliable: Sometimes in the middle of the talk party is unable to hear me, I still could hear party. In this case party usually ends conversation, and then we do call again, and after
-
IP Address Added But still does not allow access
I have a laptop that I take around Australia. When I'm in a hotel I link to the interest via my mobile phone using its hotspot feature. This allows me to gain access to the internet with no problem. When I go to the allowed ip addresses section of Az
-
How to clear calendar cache on Mountain Lion
At least, I think that's the problem. I have multiple Apple devices (iPhone 4s, iPhone 5, Macbook Pro running 10.8.3, and Macbook Air running 10.7.x (it's not in front of me at the moment)), and we're talking about an Exchange calendar. I deleted all
-
Premiere Pro CC will not Fully Load
Hi, I purchased PPCC recently and for some reason it refuses to start up. The app pops up but then shuts down immediately. I've cleaned up the registry and cleaned up even more space hoping that would do something. It worked perfectly during the 30 t