Classes in as3
i use AS2 and wish to start using AS3, however i fid it confusied with CLASSES.
is it possible to learn and use AS3 without classes?
Yes, you can learn AS3 to a useable extent without learning how to create classes. Though you won't get far in any version of Actionscript without knowing how to use classes. Even with AS2 you have likely been using classes all along without realizing it. A MovieClip is a class, a Button is a class, a TextField is a class, and on and on...
Similar Messages
-
How to use geturl using class in AS3
i try this code (my class name is bAEForm)
package {
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
public class bAEForm extends Sprite {
public function bAEForm() {
var url:String = "http://www.google.com";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.exampleSessionId = new Date().getTime();
variables.exampleUserLabel = "guest";
request.data = variables;
request.method = URLRequestMethod.POST;
navigateToURL(request);
I got error this error
The class “bAEForm” msut subclass “flash.disply.SimpleButto” since it is linked to library symbol of that type.I got the solution but again facing some problem. When I go my scene (where I put my button), Automatically 2 browsers are open. I don’t need this. I need, when I press my button then browser should to be open
Any suggestion
package {
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
public class bAEForm extends SimpleButton {
public function bAEForm() {
var url:String = "http://www.google.com";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.exampleSessionId = new Date().getTime();
variables.exampleUserLabel = "guest";
request.data = variables;
request.method = URLRequestMethod.POST;
navigateToURL(request);
I got the solution but again facing some problem. When I go my scene (where I put my button), Automatically 2 browsers are open. I don’t need this. I need, when I press my button then browser should to be open -
Importing classes confusion AS3
I must admit, I don't know Actionscript 3.0 extremely well but I know my way around it and am able to get by as a designer.
I'm just wondering if classes should ALWAYS be imported. The reason I ask is because sometimes I don't import classes but my Actionscript still works without any problems.
Just wondering if anyone could shed some light on this please?
ThanksAre you using custom classes? If so then all of the ones you use will be required.
So suppose you have in your code:
var myInstance:SomeClass = new SomeClass();
Then at the top you should add
import com.mydomain.somePackage.SomeClass;
Or if you are using packages like TweenLite or such. Even if you have added that to your classpath and it works without the import statement, it would be a surprise if you move it to another machine that doesn't have that installed.
And of course the best way to find out is to have a problem where something goes wrong. That is really all that separates the noobs from the "pros" -- we have made a lot more mistakes than you've even thought of yet! -
Instantiating MXML class in AS3
I have a simple MXML component:
-- code -- 'MyClass'
<mx:Canvas ... creationPolicy="none" ... >
<mx:HBox id="innerPanel" >
<mx:Canvas ... />
</mx:HBox>
</mx:Canvas>
-- /code --
I'm trying to instantiate this in AS3 as so:
-- code --
var myClass:MyClass = new myClass();
myClass.createComponentsFromDescriptors(true);
-- /code --
myClass is created, but no children. myClass.childDescriptors is empty.
What am I doing wrong?
thanx,
rickbUnfortunatelly nothing of the above works when you have a chain of MXML's and AS's that are instantiating eachother. Not even the combination of all of the techniques mentioned earlier.
I tried all of the above on the entire chain, and even placed callLater in the main canvas container but still creationComplete in MyMXML happens after callLater.
I tried to be creative with the bellow pseudo pseudo code, I hope you get the idea.
<MyMainCanvas>
<script>
onCreationComplete
var myClass = new MyClass();
addChild(myClass)
callLater(doSomething)
doSomething()
// does nothing as none of the properties are available from MyMXML
</script>
</MyMainCanvas>
MyClass extends Canvas
function MyClass()
var myMXML = new MyMXML();
addChild(myMXML);
<MyMXML>
<script>
onCreationComplete
// this gets called after callLater in MyMainCanvas
</script>
</MyMXML> -
I am still learning AS3, and I was woking with sounds. This
was to be used to stop the cound assigned to the channel1 var. When
I click the button the sound is just muffeled a bit, but does not
stop playing. Does anyone know it there is an issue with flash
running in Windows Vista?
Here is the code:
//Stop Function
function stopClick(evt:Event):void{
channel1.stop();
bStop.addEventListener(MouseEvent.CLICK, stopClick);
ThanksI figured it out. When I added the soundLoaded function, I
thought I deleted the .play() and head of my code. Now it looks
like this, and works.
//Creates a var musicURL and assigns it the background
music.mp3 location name
var musicURL:URLRequest = new URLRequest("background
music.mp3");
//Creates a var sndMusic and points it to the musicURL
location
var sndMusic:Sound = new Sound(musicURL);
//Creates a SoundChannel var
var channel1:SoundChannel;
//Plays the sndMusic and assigns the soundChannel to channel1
function errorMsg(evt:IOErrorEvent):void {
trace("The sound could not be loaded");
sndMusic.addEventListener(IOErrorEvent.IO_ERROR, errorMsg);
function soundLoaded(evt:Event):void {
trace("Sound Complete");
//Plays the sndMusic and assigns the soundChannel to
channel1
channel1=sndMusic.play();
sndMusic.addEventListener(Event.COMPLETE, soundLoaded);
//Stop Function
function stopClick(evt:Event):void{
channel1.stop();
bStop.addEventListener(MouseEvent.CLICK, stopClick);
//Start Function
function playMusicClick(evt:Event):void{
channel1.stop();
channel1=sndMusic.play();
bPlayMusic.addEventListener(MouseEvent.CLICK,
playMusicClick);
Thanks. I hope this will be useful for who ever else make the
same mistake I did. -
Page turn class for AS3?
Hi...
I´m looking for a class for making page turn (flip page) effect for Actionscript 3 .fla project. I have found a few quite nice ones but I can´t find a way to implement to my project.. most of them requires that pages of flipped book or magazine should be either separate externally loaded files or movieclips in local library...
In my case pages are keyframes in timeline of externally loaded swf. I have a next/previous page buttons, and when user clicks them, he/she moves in timeline of that loaded SWF. So I should find a way to make kind of page transition that triggers when user moves from keyframe to another.
Any ideas?Yep, what I thougt was that when user pushes the next page buttons, few things happens almost simultaniously
-a new bitmap copy of current spread appears on the top of current spread
-swf goes to next spread (next frame) behind bitmap copy
-some page turn animation will be applied to bitmap copy, it reveals next spread that lies behind
I just thougt it would be nice to find some class that creates something like that but I have almost given up...=) -
I just want my classes to compile.
Hello,
I'd just like to do something simple: compile a test class in
AS3.0 (Flash CS3 on Mac OSX 10.4).
Not having any luck, nor can I find any documentation. Hoping
someone can help here. Here is what I have set up:
- file structure: Inside a folder called "Notation" i have
the files "editField.as" and "editFieldTest.fla"
- class path: Points to the "Notation" folder
- code in the "editField.as" file is:
package Notation {
import flash.display.MovieClip;
public class editField extends MovieClip { //Compiler wanted
me to extend MovieClip
function editField() {
trace( "editField.class" );
- code in frame 1 of "editFieldTest.fla":
import Notation.editField;
var tf:editField = new editField();
I've played with this a lot and the error messages vary. All
I need is the correct way to set this up to get the class to
compile.
Thanks.
Mark Goodes
Flash MX expert
Flash 3.0 newbieThanks for the quick reply, kglad. Love your site!
Unfortunately though when I tried your suggestion it didn't
fix the problem. I got the error message:
5001: The name of package 'Notation' does not reflect the
location of this file. Please change the package definition's name
inside this file, or move the file.
/Users/markgoodes/Documents/Flash CS3
Projects/Notation/editField.as
I really wish the message would tell us which change was
required instead of making us guess.
Mark -
Buttons in AS3??????
I used to use a script like this in a frame on the timeline
to add functionality to my buttons.
btn_01.onRelease = function(){
_root.targ_Main.loadMovie("oranythingelseineededthebuttontodo");
Now in AS3 I have no clue!!!!!!!!!!
And apparently you have to be some sort of uber programmer
just to read the documentation. Can anyone tell me how to make a
simple button work?leodsmith,
> Now in AS3 I have no clue!!!!!!!!!!
Yes, things have changed, but keep in mind, you don't *have*
to use AS3.
Your publish settings (File > Publish Settings) let you
configure any FLA
for ActionScript 3.0, 2.0, 1.0, and even older versions
(precursors, really)
of the language.
> And apparently you have to be some sort of uber
> programmer just to read the documentation.
I realize it can feel that way, but there's a trick to
figuring out the
documentation, and it call comes down to something called
classes. In a
nutshell, classes are like recipes, or blueprints, for the
objects you now
and use every day in Flash. If you're using a button symbol,
you're
actually dealing with a button object; that is, an instance
of the Button
class in AS2 or the SimpleButton class in AS3. If you're
using a movie
clip, you're dealing with an instance of the MovieClip class,
regardless of
the version of AS. Text fields are defined by the TextField
class. Sounds
are defined by the Sound class, and so on.
ActionScript 3.0 has a larger API (more classes) than
previous versions,
but it's structured the same way. For example, AS3 provides a
set of
companion classes for audio: Sound, SoundChannel,
SoundTransform, and
SoundMixer. AS2 only provides a Sound class. On the face of
it, that may
seem easier because it's less to deal with ... but every coin
has two sides.
In AS2, the concept of a sound channel is present (this is
the thing that
lets you differentiate between different "sound banks"), but
there is no
SoundChannel class. Instead, AS2 associates Sound instances
with a
particular timeline (that is, with a movie clip) ... so even
if AS2 is more
familiar, it isn't always as intuitive as it should be.
Okay, back to classes. So classes define objects, and as a
general
rule, classes are categorized into three headers: Properties,
Methods, and
Events. Sometimes you'll see a few more, but those three are
the main ones.
Properties refer to an object's characteristics (width,
height, number of
letters, volume, etc.). Methods refer to things the object
can do
(gotoAndPlay(), setTextFormat(), attachAudio(), etc.).
Finally, events
refer to things the object can react to (mouse ups, the end
of an audio
file, the passing of a timeline frame, and so on.)
So if you're looking up something about buttons, try the
SimpleButton
class in AS3, or the Button class in AS2 (usually, the class
names are the
same for both versions; this happens to be an oddball). Look
up events, to
see what sort of "can react to" opportunities exist for
buttons, then check
out the sample code. Granted, that may be easier said than
done -- new
stuff is always bewildering until you get familiar with it --
but I hope
that at least helps you get your bearings. Be aware that most
classes
inherit functionality from each other (just like genetics in
humans), so
when you see hyperlinks in the documentatoin for showing
inherited
properties, methods, or events, be sure to click them!
In this case, as NedWebs correctly pointed out, you're going
to use the
addEventListener() method to associate a particular
MouseEvent with a custom
function. In principle, this is the same way it happens in
AS2 (unless
you're attaching code directly, which AS3 doesn't support).
AS2:
btn_01.onRelease = function() {
// something to do
Here, you're using an anonymous function (meaning, the
function isn't
named). You could also do this:
btn_01.onRelease = clickHandler;
function clickHandler() {
// something to do
... which, on a certain level, is pretty much the same thing.
Giving your
function a name is arguably better, becuase if you ever need
to kill that
event handler, you can set it to null:
btn_01.onRelease = null;
... and then, if you ever need to re-enstate that event
handler, you can
simply re-associate it with the same previously named (and
already declared)
function:
btn_01.onRelease = clickHandler;
So in AS3, you're doing the same thing:
btn_01.addEventListener(
MouseEvent.CLICK,
function(evt:MouseEvent) {
// something to do
... or, for more control, use a named function:
btn_01.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(evt:MouseEvent) {
// something to do
See the similarities? In AS3, the event actually sends
itself to the
receiving function, which is where there's a parameter inside
the function
(I used "evt", but you can use whatever variable name makes
sense for you).
This parameter is typed as an instance of the MouseEvent
class because, as
you can imagine, it's an instance of the MouseEvent class.
Like any other
class, MouseEvent has properties (listed in the MouseEvent
class), and one
of those properties lets you refer back to the object that
dispatched the
event in the first place.
It's all in there; you just have to dig a bit and see what
your options
are.
Here are some links that might give you a hand:
Colin Moock
http://www.insideria.com/2008/01/actionscript-30-is-it-hard-or.html
http://www.insideria.com/2008/07/the-charges-against-actionscri.html
One of my blog entries ...
http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3
(written for Flash CS3, but it's about AS3, so it still
applies)
Obviously, these Web references are free, but you might also
get
something out of an AS2-to-AS3 migration book I recently
co-authored for
O'Reilly:
The ActionScript 3.0 Quick Reference Guide
http://tinyurl.com/2s28a5
(only two Amazon reviews so far, but they're both 5 out of
5)
David Stiller
Co-author, Foundation Flash CS4 for Designers
http://tinyurl.com/5j55cv
"Luck is the residue of good design." -
Hi all,
I am trying to develop a multi player game using FLEX as the
GUI and pure JAVA
as the server. i want to use a message CLASS between client
and server.
some thing like:
http://www.fireleg.com/
but i want that the communication layer will be a CLASS and
not String.
so I am trying to transfer a CLASS between AS3 and JAVA with
no success.
i am using IExternalizable and Externalizable
(readExternal,writeExternal)
and i am getting: StreamCorruptedException.
I working on it with no success and i wounder if there is a
working example for that.
only 4 classes needed:
AS: client.as , message.as
JAVA: server.java , message.java
P.S
i do not mind using AMF3 as long as i can see a working
example.
thank you
gil michlinHi. Take a look at this blog posting.
http://yaa-blog.blogspot.com/2008/08/remoting-with-blazeds-from-plain.html
Basically, you need to call registerClassAlias yourself rather than having the Flex compiler (mxmlc) do the magic for you.
The mxmlc compiler takes the RemoteClass metadata and creates a registerClassAlias call in a static init block in some actionscript it generates. This actionscript is then compiled into the swf that is your Flex application. If you are not using Flex then you are missing this step and need to write the code that mxmlc would have generated for you.
Hope that helps.
-Alex -
I don't have a problem as much as just a lack of
understanding:
Question: Will I run into any problems using onEnterFrame
inside a class? I know that onEnterFrame events can overwrite each
other if they are written dynamically, but I'm not sure how this
effects classes...
Also, onEnterFrame is an event of the movie clip class right?
...does that even matter...? What happens if I declare an
onEnterFrame event inside a method inside my class: will it even
work? will it effect the movie clip from which the class.method is
being called?
Sigh... Hopefully you get the idea of what I'm having trouble
grasping. Please explain any concepts you think I appear to be
missing. I'm new to classes - thanks for your help.>>Question: Will I run into any problems using
onEnterFrame inside a class?
No.
>>Also, onEnterFrame is an event of the movie clip
class right? ...does that even matter...?
No. Here is a brief explanation how it works.
First of all, a class is a custom object. Don't think of a
class as a bunch of code, it's a custom object with its own
properties and methods. So when you say: "What happens if I declare
an onEnterFrame event inside a method inside my class: will it even
work?" you are thinking: "there is no timeline". Yes, there is.
When you declare:
private var my_mc:MovieClip;
you are saving the functionality of the MovieClip Class in
my_mc. Therefore, my_mc will have a timeline and all other
properties and methods of the MovieClip Class. (By comparison:
usually you don't need all the functionality of the MovieClip
Class, so AS3 offers us the Sprite Class which is a basic
implementation of a movieclip and that saves overhead).
In a method you can use:
private function mover(target:MovieClip):Void{
target.onEnterFrame=function():Void{
this._x+=2;
passing the my_mc to function mover as a parameter. If at
some time you want to stop the onEnterFrame you delete it just as
you would using it in code on the timeline.
Again. The most important thing to understand is that a class
is not a bunch of code, it's a (custom) object with its own
properties and methods. -
Importing classes does not increases SWF size
Hi, there!
I was doing tests, and realized that the some classes of AS3
does not increases the size of the SWFs. In AS2 UIComponent class,
for sample, the SWF increases 4 kbytes importing this class
(UIComponent).
So, I ask you: which classes does increase files size?
Thank you in advance.
CaioToOn!Hi, Andrei!
I've already tested instancing then. And the SWF file became
636 BYTES, not even 1 Kb. I believe that this size (636 bytes) are
only about the bytes of the characters of the Class. Look the code
below:
package
import flash.display.MovieClip;
import flash.filters.BevelFilter;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.filters.DropShadowFilter;
import flash.display.Loader;
import flash.filters.GlowFilter;
import flash.text.TextField;
public class Main extends MovieClip
private var e:BlurFilter;
private var e1:DropShadowFilter;
private var e2:TextField;
private var e3:GlowFilter;
private var e4:BevelFilter;
private var e5:ColorMatrixFilter;
private var load:Loader;
public function Main()
load = new Loader();
e = new BlurFilter();
e1 = new DropShadowFilter();
e3 = new GlowFilter();
e4 = new BevelFilter();
e5 = new ColorMatrixFilter();
te.filters = [e, e1, e3, e4, e5];
e2 = new TextField();
e2.text = "CaioToOn!";
addChild(e2);
It really don't increases the file size. Only because of the
extra characters.
CaioToOn! -
[AS3] Losing my religion: subclassing vs. composition
I have been until now a fervent disciple of compositing a
graphic instance into a class in every case, rather than making my
class extend MovieClip. Admittedly I was a piker at AS2 and only
now that I am cranking on AS3 do I consider myself worthy to call
myself a beginner OOP programmer. But I bought into all the
reasons, and if I were still making AS2 apps, I might remain in
that camp.
But lately my devotion has been shaken and now I am seriously
considering extending (and then subclassing from) MovieClip or
Sprite when making any class which has a visual component. Whereas
before I would always compose in a MC instance, almost never make
my class inherit from anything but my own superclass, and implement
interfaces for polymorphism, now I think I will extend, although
still implement interfaces for the usual other reasons. I also
still plan to be a composition devotee in all other ways-- I like
composition more than inheritance. Also I would not extend MC for
classes which have no graphical component, such as game logic
components. (I am making games and other interactive entertainment
apps, for in-browser distribution.)
Can I please be illuminated by better coders than I as to the
wisdom or folly of my change of heart?
Here are a few reasons why my mind is changing; please feel
free to refute or support any of these:
--Changes between AS2 and AS3 make the downside of
subclassing MC/Sprite smaller than before. I'll let far more
informed people come up with good examples, but one seems to be the
explicit nature of adding an object to the display list-- the
overhead hit of being an MC is small (nonexistent?) if it is not on
the list.
--Colin Moock, in his seminal "Essential ActionScript 2"
book, advocated composition-- see his large MVC example in which
his view class, although nearly entirely visual in function, did
not extend MC but rather composited MC. However, in Moock's equally
impressive AS3 book, all his examples now seem to use extension. I
really admire Moock so this gives me a new perspective.
--All the Adobe best practices and examples use extension, as
do nearly all code samples I see in other helpful forums. I am not
one to blindly run with the crowd but I think I'd get better
feedback on my code from my peers if I follow suit.
--All the AS3 Flash components seem to use extension, and
indeed, AS3 itself is heavily inheritance-based rather than
composition-based, for understandable reasons.
I am probably missing a lot and mis-stating much of what is
there but hopefully you get the idea.
So once again I ask my better peers: what are now the
arguments for and against extending MC or Sprite for one's visually
represented classes in AS3? Any observations would be much
appreciated.Here is a bit more concrete example:
In Moock's AS2 book he has an extensive example of the MVC
pattern involving, what else, a clock. In his code his Clock view
does *not* extend MovieClip (Sprite not having been available in
AS2), which is in keeping with his general admonition to compose a
graphic element into a class rather than extend one. His view's
constructor takes an MC as an argument, and the view attaches its
MC instance (which contains all the clock visuals) to the passed
MC. The view object is not itself attached, because it is not an
MC. The view class contains an MC which ends up getting attached.
To change the XY of the view would be to ask the view to change its
MC instance's XY. Pure composition.
In Moock's AS3 book he has an extensive "Virtual Zoo" example
which among other things uses an MVC-ish structure, in which the
view and controller are the same class. If anything, this would
make composing in the view's root graphic element even more
sensible than his AS2 example. The View does not really fit the
definition "is-a Sprite"; it also is a view manager and controller.
But, contrary to his AS2 stance and in keeping with all the other
examples in his AS3 book, Moock's view class *extends* Sprite, and
is added as a child by the main class. Though the view does happen
to contain objects which are also made from Sprite-extending
classes (pictures of the zoo animal and the like), the view class
does not contain its root sprite the way the AS2 example contained
its root MC. The view *is* a Sprite. To change the XY of the view
would be to simply set its inherited XY properties from the
outside, as any Sprite would be positioned. So though Moock still
is a devotee of composition in every other way, on this one point
he seems to have decided to use inheritance and take a path
different from his AS2 book.
And I have seen most other AS3 code examples follow suit. The
Lott AS3 book does, and all the Adobe examples do. So forgive me
for having my faith shaken a wee bit.
Though I remain convinced of the rule to favour composition,
in this particular set of cases I am considering routinely using
inheritance, even though I easily *could* use composition. It just
seems to be messier, denser, and longer to use composition *in this
set of cases*. So is my reasoning good, faulty, or does it simply
betray deep cluelessness about OOP? -
I have been following a couple of discussions online bout the
absence of the web service classes in AS3. As far as I can tell,
the Adobe Developer Team will implement them eventually, but
unfortunately this has not yet been confirmed by Adobe.
I would very much like to know if the web service classes
will be coming and if possible an approximate timeframe.
The only proper solution I have seen so far is to use
compiled swc's, which is a very download heavy solution.
Our business rely heavily on web services, and the old AS2
WebService classes and the web service panel, was a great
implementation, inspite a few bugs in the system :)
Long story short; Will web services be implemented in AS3 by
Adobe, or do I need to look elsewhere for a solution?Hi bnailWedge,
That doesn't sound quite right to me, at least not the way
I'm seeing it
put together. AMFPHP does what SOAP does, literally. It does
it using a
different message format (AMF instead of the XML-based SOAP),
but the uses
and applications of both are the same. AMF is smaller and
faster and
Flash-only, and AMFPHP is one of the few "break-out" projects
that allows
you to use this binary format without having to run a
ColdFusion server.
However, running AMFPHP and SOAP side-by-side seems to me to
be duplicating
functionality.
That's not to say this can't be done; I'm sure it's 100
feasible, just
seems somewhat redundant. Was there a specific application
that you were
aiming to use this on? If you're looking for something fast,
small, easy to
maintain, easy to deploy, scalable, adaptable (not limited to
Flash and
PHP), and unique, I wrote something very similar called XMLs
(XMLserialization). It sends data back and forth from Flash
to/from PHP. It
also has the unique feature of allowing remote method
invokation
bi-directionally. Flash can invoke server methods, PHP can
invoke Flash
methods. Right now, all web services are invoked on the
server only. I
integrated an older 128-bite encryption library which, from
what I
understand, no remoting or web services platform currently
offers. I'm
working on whole-system serialization so that I can transfer
and
store/retrieve any Flash content like MovieClip instances,
audio data, or
anything else I can stick in a byte array. Also, a big bonus
from my point
of view, it's 100% free and open source (LGPL). If nothing
else, I could
point you to the code sections where the magic happens and
you could rip out
what you wanted. It is actually simple and easy to
understand. It still
needs a bit more work but it's not far off from what I would
consider 100%
complete.
Please free to drop me a line if you want me to send you a
package (it
will be on SourceForge soon, just have to "professionalize"
the package and
associated libraries a bit). patrick (AT) baynewmedia (dot)
com
Regards,
Patrick Bay
BAY NEW MEDIA
"bnailWedge" <[email protected]> wrote in
message
news:[email protected]...
> The reason I am asking is that I saw, over a year ago,
examples of
> amfphp/PHP
> acting as a bridge between Flash and some SOAP services
(Google was the
> example
> I think). Thought it might be of help. I cannot find it
now though.
> -
Compatibility Issues with AS3 & 2
This question has a few parts actually. Let me lay down the
groundwork - I'm starting a new project, but I have yet to decide
whether or not I will create it in AS 2 or 3. One thing the swf
will do is load other swfs into it - it also will need to somehow
connect with these loaded SWFs and transfer data back and forth. I
understand the compatability issues associated with loading AS 2
swfs into AS3 - see here -
http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=L iveDocs_Parts&file=00001801.html
At the bottom right of the chart, adobe suggests that AS 1.0
and 2.0 can "cross-script" with AS 3 using localconnection. There
are already SWFs developed that need to be loaded into my new
project, and I would like to create new SWFs as well, some of which
may benefit from being coded in AS 3 (as well as possibly being
created in Flex). I also think that overall my project will benefit
from using AS 3. However, there are a few issues that I can't
resolve - here are my problems -
If I create my project in AS 3, and then load SWFs that use
AS 2, the project can access the loaded SWF through a
localconnection - however, can they pass objects, like XMLNodes, to
each other, and each understand the other, even if one uses AS2 and
one uses AS3? Or can they only invoke functions on each other's
sides...
If they cannot pass objects to each other, what I may
consider doing it creating the project in AS3 and requiring all
SWFs that are to be loaded into the main project to be rewritten in
AS3 - that way the loaded swfs can pass data safely to the loader.
My other question - supposing this is the case, say I want people
to be able to develop SWFs for my project, but they are used to
using the flash IDE - flash 9 wont be out for a few months...they
can create an .fla in flash 8, write actionscript classes in AS3,
then load it all into the flash9 preview and compile...making their
swf compatible with my project...can they use components, which are
coded in AS2? I dont think AS3 differs so much from AS2 that they
couldnt just code normally and then compile in the flash9 preview,
but what problems may arise from developing in this fashion? Would
that mean that people coding in AS2 could simply make a few
adjustments for AS3, load the .fla into the flash9 preview and
compile and make an SWF that is compatible and accesible from my
project? Any help on these issues would be very much appreciated -
thanks!I was trying to test this for you in AppleWorks 6 Windows XP in Parallels on my MacBook Pro, but each time I tried to open a draw file I had originally create on my Mac, AppleWorks 6 for Windows crashed.
I tried another, smaller draw document & it opens without problems & I can move the objects around. I'd suggest deleting the AppleWorks preferences, but I don't know where they are in Windows XP. -
I got a question about Object class in AS3 recently.
I typed some testing codes as following:
var cls:Class = Object;
var cst:* = Object.prototype.constructor;
trace( cls === cst); // true
so cls & cst are the same thing ( the Object ).
var obj:Object = new Object();
var cst2:* = obj.constructor.constructor;
var cst3:* = obj.constructor.constructor.c.constructor;
var cst5:* = Object.prototype.constructoronstructor;
var cst4:* = Object.prototype.constructor.constructor.constructor;
var cst6:* = cls.constructor;
trace(cst2 === cst3 && cst3 === cst4 && cst4 === cst5 && cst5 === cst6); //true
trace( cst == cst2) // false
I debugged into these codes and found that cst & cst2 had the same content but not the same object,
so why cst & cst2 don't point to the same object?
Also, I can create an object by
" var obj:Object = new cst();"
but
" var obj:Object = new cst2();"
throws an exception said that cst2 is not a constructor.
Anyone can help? many thanks!I used "describeType" and found that "cst2" is actually "Class" class.
So,
trace(cst2 === Class); // true
That's what I want to know, Thank you.
Maybe you are looking for
-
Adaptive RFC 2 gives error: com/sap/ide/jco/service/internal/R3Service
Hi, I've run into the following problem about NWDS. This happens as I create a Model. It appears there is a new version of the Adaptive RFC Model, which is called Adaptive RFC 2 Model. 1. Right click on Models, and select Create. 2. Double Click on A
-
Adobe bridge preview magnification ratios
Hi, As you know, Adobe Bridge to view the image in full screen space (space) d-pad key is pressed. Then, the image with the mouse scroll ball is 100% - 200% - 400% and 800% as the be grown.This growth rate of 50% is not 100% to start with, for exampl
-
Lightroom Unable to Import HDR Image File Opened as Smart Object
I just started using Nik HDR Efex Pro and created an image file in PS CS4 Extended which was opened as a smart object and saved to play around with later. The image shows up in Photoshop as "[image number]_hdr.tif" and both PS CS4 Extended and CS5 h
-
Hi all, I have an application with datagrid inline editing functionality. I have a custom item renderer for all the columns and i have to perform validations also on the user entered data. The itemEditEnd function goes like this, private function edi
-
See the Updates page http://developers.sun.com/prodtech/javatools/jscreator/downloads/updates/index.html for information about the latest hot fix for Java Studio Creator 2. Use the Update Center in the IDE to download and install the fixes.