Hi Matt,
I spent an embarrassing amount of time recently playing with ways to import
common classes and libraries in AS3, so your post drew my attention.  Then I
ran the class from your first post and had no error: your fullScreen
variable traces as null, as expected.

So then I read the subsequent posts.  If I understand correctly, you are
trying to load classes from an swc\swf, right?  Or have I got it wrong?

The first obvious point: your swc needs to be in the class path of your fla,
and its swf needs to be in the same folder as your other swf's.

Some other points (relating to the fla that imports the classes)...
1.)You need to declare your imported classes as variables
e.g.
public var YourClass:Class

2.) I noticed that you call init() in your constructor.  According to Moock
in Essential ActionScript 3.0, code within a class constructor block (i.e.
the class initializer) runs in interpreted mode, and is not compiled by the
JIT compiler.  So this might shed some insight as to when to use dynamic
classes or not. I don't think you need to use a Dynamic Class, but you might
try to avoid using the init() function, at least until you have the thing
working.

3.) Within your class constructor you import your classes as
YourClass = getDefinitionByName("com.foo.whatever.YourClass") as Class


Having said all that, I am still not sure I understand what you are doing.
In any case I hope this helps.


Public class
Laurie Jensen


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matt Muller
Sent: Friday, 13 July 2007 12:27 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Accessing MovieClips on a timeline from an AS3 class

I feel like a bit of an idiot asking this, but I keep getting errors. I'm
creating some custom player skin templates and have some ui elements which
are MovieClips on the stage.
Bearing in mind, this will be a swf loaded into another swf all I'm trying
to do is create class definitions and its throwing errors.

in as2, it would normally be something like name your instance on stage
'btn_fullScreen' and then in the class just type it to have access to it.
private var btn_fullScreen:MovieClip;

So in the document class I have something like this (as3) with a MovieClip
with a matching instance name "fullScreen"  thats on the stage/timeleine but
its clashing when I try and access it from the class.

and I get this error when I try to trace it.

1151: A conflict exists with definition fullScreen in namespace internal.

package com.foo.view.playerSkins {

    import flash.display.MovieClip;

    public class SkinInventory extends MovieClip{

        private var fullScreen:MovieClip;

        public function SkinInventory()
        {
            trace(fullScreen)
        }
    }
}



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to