Flex - importing custom packages

  • noflashlight
  • Novice
  • Novice
  • noflashlight
  • Posts: 22
  • Loc: Boston, MA

Post 3+ Months Ago

Not sure how many flex developers read this, but I'm really stumped.
I'm rather new to actionscript and flex.

I have created several custom mxml components and I need to be able to pass data between them. I read up and found out that I need to do something like

Code: [ Select ]
package myPackage{

public class myClass{

public var myVar1:int = 1;
public var myVar2:int = 2;

  1. package myPackage{
  2. public class myClass{
  3. public var myVar1:int = 1;
  4. public var myVar2:int = 2;
  5. }
  6. }

now I should be able to import this class and read/write to the vars from all my components. This would be great if I could get it to work. In flex builder the 'auto-complete' recognizes the class when I say
Code: [ Select ]
import myPackage.myClass;

but I still recieve the error
Definition myPackage:myClass could not be found. c1.mxml testing/myComponents

and the myPackage.as file is definitley in testing/myComponents
I've also tried adding my own new classpath to the project, and putting the .as file in there, and I get the same error.

Can someone tell me what I'm doing wrong?
  • pythagoras
  • Born
  • Born
  • pythagoras
  • Posts: 1

Post 3+ Months Ago

You say the myPackage.as file ... myPackage should be a folder containing the myClass.as file. For this setup you should have a folder in your project root called myPackage containing a class file called myClass. If you are still getting errors, can you show your folder structure, so I can see exaclty what's going on? (maybe a screenshot?)

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.