Adobe Dreamweaver Forums



Last 10 THreads :         Conditional loop (Last Post : Dan Bracuk - Replies : 4 - Views : 5 )           »          How to turn IMAGE into MOVIECLIP??? (Last Post : Snufferson - Replies : 0 - Views : 1 )           »          Please point me to the correct topic section of thisForum (Last Post : GillyWilly - Replies : 8 - Views : 9 )           »          DIV in Table not working. (Last Post : adambaum - Replies : 0 - Views : 1 )           »          pop up blocker jacking my login (Last Post : reelhero - Replies : 2 - Views : 3 )           »          SWF slide show does not play (Last Post : Mad Dog - Replies : 3 - Views : 4 )           »          Flash-PHP Mail Form (Last Post : richmaxw - Replies : 0 - Views : 1 )           »          Flex compiler in FlexBuilder and Flex SDK (Last Post : 2009 Matt - Replies : 0 - Views : 1 )           »          Basing new project on old project (Last Post : Stephen Windham - Replies : 2 - Views : 3 )           »          Performing a search within multiple .as files (Last Post : JohnnyDang - Replies : 0 - Views : 1 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 10-31-2008, 06:26 PM
jkpritchard
 
Posts: n/a
Diggs:
Default accessing local namespace classes from AS3

Hi,

I'm trying to create a little browser application that will allow me to select
one of my symbols and add it to the screen. The class associated with the
component is in the local namespace (xmlns:local-"*"). I can add the components
through mxml with no problem, but when I try to add it through actionscript,
the compiler says that the class is not defined when I use
getClassDefinitionByName(className) as Class.

Why is it that I can use <local:className> to add it but I can't use
var:symbolName:className = new className()?

I looked at the 'use namespace...' documentation, but a) I don't know where to
define my class as being part of a namespace, and b) how do I access it through
actionscript ( is it local::className ???).

Thanks in advance.






Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-31-2008, 06:26 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: accessing local namespace classes from AS3


"jkpritchard" <webforumsuser@macromedia.com> wrote in message
news:gd2c0e$rlj$1@forums.macromedia.com...
> Hi,
>
> I'm trying to create a little browser application that will allow me to
> select
> one of my symbols and add it to the screen. The class associated with the
> component is in the local namespace (xmlns:local-"*"). I can add the
> components
> through mxml with no problem, but when I try to add it through
> actionscript,
> the compiler says that the class is not defined when I use
> getClassDefinitionByName(className) as Class.
>
> Why is it that I can use <local:className> to add it but I can't use
> var:symbolName:className = new className()?
>


try:

new classN

then press and hold the control key and press the space bar. If there is
more than one class that shows up, use the mouse to select your class, then
press enter. You will find that this will make the proper import for you.
However, if the class is at the root of your src folder, it shouldn't need
to be imported, in which case I'm not sure.

HTH;

Amy


Reply With Quote
  #3 (permalink)  
Old 10-31-2008, 06:26 PM
LuigiL
 
Posts: n/a
Diggs:
Default Re: accessing local namespace classes from AS3

>>The class associated with the component is in the local namespace (xmlns:local-"*").
What class do you mean here?
Reply With Quote


  #4 (permalink)  
Old 10-31-2008, 06:27 PM
ntsiii
 
Posts: n/a
Diggs:
Default Re: accessing local namespace classes from AS3

Be careful not to confuse XML namespace with Package namespace. the Namespace
class and the double colon syntax are for XML namspace only.

Import, package declaration and xmlns are all package namespace oriented.

I assume this is a typo: xmlns:local-"*").

Also be aware that when using getClassDefinitionByName, you must have a hard
reference to that class declared somewhere in your app, or the class will not
get linked in by the compiler. A dummmy variable is often used.

Finally, I don't use a prefix for local classes, just xmlns="*". Perhaps
doing so makes you explicitly use local like this?
var symbolName:className = new local.className()
Truly just guessing on this one.

Tracy

Reply With Quote
  #5 (permalink)  
Old 10-31-2008, 06:27 PM
jkpritchard
 
Posts: n/a
Diggs:
Default Re: accessing local namespace classes from AS3

Thanks for the help. I think I did exactly what Tracy was talking about and
thought that the xml namespace and the package namespace were the same thing.

I had my packaged code outside the src folder (in lib), so none of it could be
located (which I know now could have worked if i set the reference correctly in
the project).

Everything has been moved to the src folder (including the package structure),
and everything is working fine now.

After using Flex Builder for only a couple of weeks, I have to say I love the
IDE. Code completion for custom classes is such a great thing that the Flash
IDE never could do.

Thanks very much to everyone who responded.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 07:36 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk