AS2 vs. AS3 Button
So in AS2 to add button functionality to a movie clip, you'd
type:
myButton_mc.onPress=function(){
gotoAndPlay("something");
How is this accomplished in AS3 WITHOUT using external .as
files, classes, etc?
It seems like all the tutorials/books I read, they want to
create the bible before anything can be done.
If this is the case, why is AS3 better? I understand it
appeals more to hard core programmers of Java, but what about
therun-o-the-mill types who actually like Director's Lingo and can
cope with AS2?
Thanks!
Well, one of the big advantages AS3 has is that it`s 10 times
faster than AS2. Then, it`s easyer to learn for beginners, because
everyting is done similarly( you decalre any variable the same way,
every listener etc...) etc...
Similar Messages
-
Hello, i'm somewhat decent in flash. I know AS2, i started
learning AS3 today and find it to be more complicated and has so
many extra steps in coding. Number one thing i hate is having to do
all the code on the timeline, it will get so full of code if i have
several buttons/movieclips that need code, no way to do code when
you click on the button/movieclip in AS3 unlike 2.
Would it be dumb for me to continue to use AS2 and learn more
of it, or should i keep trying to learn AS3..... I don't do super
complex stuff, mostly timeline navigation and animations.
I also feel like there is way more room to make errors in 3
because you have to type everything unlike AS2 where i was able to
use the actions frame (use that plus tool that had the drop down
menu).I'm in the same position, just starting to move from
intermediate comfort with AS2 to a fresh beginning with AS3...not
so easy for a guy who has so little logical thinking that I failed
algebra in high school! I too am a bit annoyed by all the extra
steps involved, such as having to add EventListeners for mouse
events, when these really ought to be simplified and there by
default, like in AS2. For example, why can't onMouseDown remain as
a built-in behavior rather than having to take up 2 lines of code
to insert it each and every time now?
On the other hand, I am delighted at the way a lot of the
inconsistencies in AS2 have been gotten rid of. No more having to
remember when to put .x and when ._x, and so on. And now that I'm
finally starting to learn how to use external classes, I see the
beauty in it, and AS3 is custom-made for this. It seems that if you
ever want to really advance in ActionScript programming, you need
to start working with creating your own classes, and as long as
you're going to learn those from scratch, may as well learn it in
AS3.
Putting AS on buttons was outdated practice years ago. It
makes much greater sense to place all script on the timeline, with
comments to separate it. Try programming the simplest game where
objects are moving around and colliding, all controlled by script,
and then a couple coded buttons control them. Bugs are inevitable,
and debugging script when it's partly on the timeline, some is
attached to main movie buttons, and some attached to movie clips
inside movie clips, is a nightmare. Once you do scripting on the
timeline, you'll never want to go back to the crude practice of
attaching script to objects.
Overall, it's a steeper climb than I'd have liked, to upgrade
my knowledge from AS2 to AS3. But ultimately I think it's the best
idea. -
Confused about AS3 buttons (did read David Stiller's blog)
I'm trying to convert an AS2 file over to AS3 and I can't get
the buttons to work. They do not want to gotoAndStop at certain
frames in specific scenes. In the following code, if you click on a
button it works fine, but when you attemp to change to a new Scene,
it breaks and both buttons won't work thereafter. I've tried
everything for almost a day now and cannot get this to work and
cannot find any reference to the problem. Is AS3 buttons not able
to go to a new scene as it suggests in the Help files?:Laura,
> Old patterns, old habits...time to change.
Well, not necessarily! The old ways still work. :) Just
configure
your publish settings for AS2 or AS1, and bingo. It all
depends on what
you're trying to accomplish. If your aim is to output to TV,
then by all
means, use scenes! If you're not using code -- or using very
little code --
then it basically doesn't matter what version of ActionScript
you use.
> Now the flash animation drawing tools are so lame it's
just
> embarrassing. It's all about interactivity and coding is
essential.
I can hear that you're frustrated, and it probably helps to
vent (it
often helps me), but for the sake of others who might be
reading this
thread, I'm respectfully asking you for specifics. What new
animation
and/or drawing tools do you mean? How are they embarrasingly
bad?
The 3D and inverse kinematics (IK) tools, new to CS4, are
hardly
something I'd call embarrassing. On the contrary, they're
cool all hell!
True, the 3D tools require the FLA to be configured for AS3,
but no
scripting is required to use 3D or IK (though you *can*
script them if you
want to).
The blend modes and filter effects introduced in Flash 8
were a welcome
edition. They didn't hinder anyone's workflow, as far as I
know. If you
wanted to use them, great! If not, great! Improved text
rendering has been
a joy ... and again, use it or not -- the choice has always
been up to the
designer's whim.
> Ok, scenes are kinda old school. I can see why.
They're only problematic (speaking historically) in cahoots
with
ActionScript. Unlike some, I actually do endorse the use of
scenes ;) --
just not in the context of programming. Keep using old school
if that's
what works for you. If you like, experiment with the new
stuff as your
schedule allows.
> Why do anything in the timeline if you can do it in the
code?
I can't tell if you're being sarcastic in this line, but
either which
way, the answer (at least, from my perspective) is a
pragmatic one. Use the
timeline when doing so takes the least amount of work; the
reverse holds
true for code. There are plenty of animations --
specifically, character
animations, including lipsynch -- that, for me, are easier to
do by hand, by
direct manipulation of the symbols with my mouse and/or
graphics tablet.
I find it easier to design complex gradients using the
drawing tools. I
often find it easier to design complex tween eases by hand.
When I'm
working on animation, I tend not to code as often; when I'm
building a
Flash-based website, it's likely to be a combination of
timeline techniques
and code; when I'm writing applications, it's obviously a
case of
mostly-code.
> [code gives you] more control. It can be more dynamic
and
> flexable. It is easier to edit. Next I need to do more
external
> .as doc scripting.
Writing custom classes is another layer of technique.
Depending on your
workflow, it may or may not be useful. For what it's worth, I
wrote a
tutorial series for Community MX not so very long ago that
might help
illustrate this point ...
http://www.communitymx.com/abstract.cfm?cid=ECBF0
... the first article is free, and demonstrates a technique
(using code) for
causing letters to wiggle into place. Over the course of
several
installments, this series works toward moving the code from
the timeline to
a class file, which shows how custom classes can provide a
workflow boost,
even for a movie that doesn't necessarily need to be
übercoded in other
respects. I hasten to add, I'm not one who relishes the role
of a "Here,
the first one is free" salesman, so be aware that you can
also read the
remaining articles free if you sign up for a trial
membership, which you can
cancel without obligation in a week's time.
> My working file is now all on a single timeline with no
scenes.
> Who needs scenes. Yipee!
Under the hood (meaning, in the SWF) all those scenes are
ultimately
converted to one big timeline anyway. Granted, the use of
scenes is a
convenient organizational tool during authoring, and I don't
deny that
scenes-with-ActionScript would be equally convenient, but
again ... scenes
have been "broken" in ActionScript for a long time. It looked
like Flash
CS3's AS3 finally resurrected the workflow, and -- for the
time being -- it
looks like CS4 might somehow be missing the mark. If so, as
kglad proposes,
the AS3 gotoAndPlay() issue is a bug in CS4, and we can hope
for a fix from
Adobe.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
Looking for a copy of Patrick Mineault's AS2 to AS3 converter.
Anybody have a copy of Patrick Mineault's AS2 to AS3 converter sitting around? His website closed down in May and he changed careers.
Thanks!See if this is it:
http://download.info.apple.com/Apple_Support_Area/Manuals/powerbooks/0301677CPBU G.PDF -
Plz any one convert this code from AS2 to AS3???????reoly me on [email protected]
#initclip
function Dot() {
this.color = new Color(this);
this.color.setRGB(16775372);
this._rotation = 150; /////////////////rotate of object////////////////
this._width = 30; /////////////////width of object////////////////
this._height = 30; /////////////height of object//////////////
this._x = 300+Math.random();//*8-0(X vibration type effect) /////////////X position of object//////////
this._y = 250+Math.random();//*8-0(Y vibration type effect) /////////////Y posotion of object///////////
Dot.prototype = new MovieClip();
Object.registerClass("myfirst", Dot);
Dot.prototype.onEnterFrame = move;
function move() {
this.age++;
this.relage=this.age/12;
R=255<<16;
G=(255-(this.relage*126)); if (G<0) G=0; G=G<<8;
B=(255-(this.relage*1024)); if (B<0) B=0;
this.color.setRGB(R+G+B);
this._x -= Math.random()*-2-1.25;
this._y -=Math.random()*+1.75;
this._alpha -= 3;
this._xscale -= 2;
if (this._alpha<5) {
this.removeMovieClip();
#endinitclipJust remove #initclip and #endinitclip from the code and remove all underscores, example : this._x will be this.x
Hope this helps! -
So I made this basic game a few years ago which was in AS2 and Flash 6. Now I want to convert this game from AS2 to AS3 but I have no idea where to start. The code is approximalty 4k lines long and I don't know what to change to make it work in AS3. What do you guys suggest?
Are you using external .as files and classes or are you using frame scripts directly in the timeline? Are you used to any other object oriented programming languages? Knowing more about other languages you might know would help a lot.
AS2 very informal and specialized to Flash. It relates to pretty much no other language out there, like JavaScript seldom relates. They're c-esque but only in a very distant 3rd cousin style.
AS3 is much more OOP oriented and typed versus the less formal, error-prone loose dynamic nature of AS2. While your game would benefit greatly from the speed increases and error reduction, I think you're really swinging for the fence on this one. While some classes may resemble their AS2 counterpart and the core global functions work the same, everything else is different. Starting off trying to convert 4,000 lines of code is a little steep.
As mentioned, the resources to learn AS3 are excessive and plentiful from video training to tutorials to the API reference itself. Google has it all.
I think you really should lower your target and just try some really simple, basic things. Draw a shape, add a listener, do something basic when clicked, etc. You'll get a good idea of how different things are with the new display list rather than tearing your hair out converting your as2 game. -
Hello,
i have this code
var url = _level0.video;
player.contentPath = url;
this catch a url and load on flash player.
this works fine in As2, but in As3 dont work.
i use a converter As2 to As3 but the result is it:
package {
var url = _level0.video;
player.contentPath = url;
i not a As programmer i only use video function on flash,
my question is, how to use my code on ActionScript 3 ??
Thank you !!Thanks for reply,
the variable video i get from html and php.
example:
player.swf?video=<?php echo $_GET["video"]; ?>
and the variable video i get from html
<a href="index.php?video=video.flv"></a>
ok, i discard a converter !!
to use a contentPatch source of flash ?
but i can load a external videos ??
without ActionScript ?
Thank you ! -
HTML Link -AS2 fine, AS3 weird behaviour
Hi Guys, I'm working on a project at the moment, and am
seeing weird behaviour with the way my swf handles html links
inside dynamic textboxes. When rendered as a AS2 file, the link
works on a release as expected. When its inside a AS3 file the link
will only work if the user right click and chooses 'open in new
window' was there a change in behaviour how AS3 handles these
links, or is there now an declaration needed to be made to allow
these link to have the old behaviour?
The project calls for xml data and embedded in that is a html
link. Originally I thought it might have been the way I'd formed
the xml so I tried with a hardcoded version instead (dynamic
textbox, add text -> highlight -> add link through properties
tab). But I still see the same behaviour between the as2 and as3
versions.
Any help would be greatly appreciated.
Cheers.Actually, the ''href'' attribute is supposed to direct the browser to a new URL, etc., not run a script. Instead, use the ''onclick'' event attribute:
''<a onclick = “$('.div-feedback').fadeIn();”></a>''.
Happy coding! -
Issues converting scroll bar components from AS2 to AS3
I am working on editing a document that has scroll bar components that I would like to convert from AS2 to AS3 since everytime I try to open the document it shows a WARNING and won't convert them and when I publish and look at the final document the scroll bar seems to act unusally since it is obviously still on AS2.
Here are two of the scripts I finally was able to find within it. Should I fix it and how so? This first is for the "Creative Scroll Area" and the second is for the "Creative Scrollbar"
package {
import flash.display.MovieClip;
public class Creative Scroll Area extends MovieClip {
public function Creative Scroll Area() {
// constructor code
package {
import flash.display.MovieClip;
public class Creative Scrollbar extends MovieClip {
public function Creative Scrollbar() {
// constructor codeOkay, well I know the code is making a scroll bar and a scroll area and under the "type" it says they are "compiled..." which is unusual since most of the other components I've worked with have been movie clips or bitmaps. Do I need to look up what AS3 components I need to replace the script from above? Because when I looked for that I couldn't specifically find what I needed or really understood if I was looking at the right information.
Here is something I found when trying to "debug" it:
WARNING: The component 'UIScrollBar' requires ActionScript 2.0, which is not supported in this version of Flash Professional.
WARNING: The component 'Creative Scrollbar' requires ActionScript 2.0, which is not supported in this version of Flash Professional.
WARNING: The component 'Creative Scroll Area' requires ActionScript 2.0, which is not supported in this version of Flash Professional. -
Declare new color from AS2 to AS3
Hi All,
Could you let me know how to "convert" the following code from AS2 to AS3:
var distracterBkgdColor = new Color(this.distracterBkgd_mc);
Thanks!var ct:ColorTransform = this.distracterBkgd_mc.transform.colorTransform;ct.color = 0xrrbbgg;
this.distracterBkgd_mc.transform.colorTransform=ct; -
Major gaming system Migration from AS2 to AS3
I have a major project entirely in AS2. It is made of a
Multimedia Application, which provides access to functions needed
to load games, save information, insert *.jpg files... The 50+
games each have their own graphic.swf and engine.swf, where the
graphics deal with gameplay and the engine communicates with the
Multimedia Application.
If the Multimedia Application is migrated to AS3 but the game
swf files remain the same, will the functions still be able to
communicate (call functions and send references to objects)?No, AS2 and AS3 are absolutely different animals. There are
some techniques (search for as2 as3 bridge in the net) that create
a bridge which are cumbersome in my view. -
As2 and As3 on same Flash Player
If i set AS2 codes to play in Flash Player 9, is it possible
that this swf can load an As3 swf at the same Flash Player using
As2 codes???
These swfs both play in same virtual machine which is player
version 9 but the other is coded with As2 and the other is coded
with As3. How can an AS2 load a swf coded in AS3 on same Flash
player?
Is this possible?
If yes, how? if no, why not?AS2 and AS3 swfs cannot exist in the same Flash Player
virtual machine - each Flash Player instance (version 9 and
greater) create different address spaces/virtual machines because
the requirements of AS3 and AS2 are so different. -
Hi.
I have loads of games in AS2 but a freelancer is developping games in AS3. Can I use a container movie in AS3 and load both AS2 and AS3 games in. Otherwise I would have to update all games into AS3. Would all games have to be published to the same flashplayer? ie: FS7 etc...you can use an as3 swf to load as2 swfs. if you need to communicate between the two swfs, use the localconnection class.
-
AS2 or AS3 + online Tut for beginners ?
Hi All,
Anybody can advise what is the easiest to learn for a beginner : AS2 or AS3 ?
I am trying to do a "liquid layout " in Flash and have found tuts either with AS2 or AS3. Though I am struggling to understand them and need to learn the basics either on AS2 or AS3.
If you know aswell a good website teaching the basics step by step.
Many Thanksif you invest the time in AS3 it will probably be pay off the most in the end. AS2 as mentioned earlier is a bit easier to get up and running with and for many years powered many a great flash experience, but its days are numbered.
here is a very solid overview of AS3 in short easy to understand video tutorials.
http://tv.adobe.com/show/actionscript-11-with-doug-winnie
I would urge you not to rush. take it slow. watch the videos and try to apply each concept to your own project. -
Can C++ Container Determine AS2 vs AS3
I have a C++ container of Flash Player 11 (I have also tried
Player 9 and Player 10). How can the container ask the player what
type of content it is playing (AS2 or AS3)?
If I create an event handler (ExternalInterface.addCallback)
in AS3 which returns true (depicting AS3), and call
m_FlashPlayer.CallFunction in my container, I am able to
receive/parse the ActionScript response ("<true/>").
However, if the content is "old" (i.e. AS2 which does not
have the necessary event handler) ... or if the content is AS3 and
I deliberately throw an exception (throw new Error("AS3 Error") in
my event handler) ... the C++ container has no way of
differentiating between AS2 or AS3. My container catches the
COleDispatchException, but there is no information within the
exception. Both scenarios result with an m_scError = 0x80004005
(E_FAIL).
Is there a prescribed way for a container to ask the
Shockwave player if it is playing AS2 or AS3 content?You are confusing the Shockwave Player (which runs
Director-created
content) with the Flash Player
Maybe you are looking for
-
Boot Camp won't recognize my AMD 6970m Video Card
Hello! About a week ago, I received my brand-new 27" iMac, which came with Boot Camp installed and executed via VMWare. Its main system specifications are: - Intel i5 Quad Core @3.10 Ghz (performance rated at 9.30 Ghz) - 4GB RAM - AMD Radeon HD 6970m
-
Layout mode....totally confused
While I've used Logic for several years I'm a total beginner at assigning MIDI controls for live work, or indeed for anything as I've never had much need to. I am therefore finding the Layout mode utterly beyond me, as so far nothing the manual claim
-
So my computer keeps saying check video cable but I use a do cable and monitor keeps going to sleep and says no signal what do I do I have a HP 2011x
-
Open the Library/Screen Savers?
Hello, I run Leopard, and I tried to use PackageMaker to package up a Quartz Composition I made. I tried to make PackageMaker place the composition into User/Library/Screen Savers, but that would not work. It would work fine in my account, but if I t
-
Error whyle synchronize audio an midi
Hi everybody, using a MacBook 13 inch 2 GHz intel Core Duo, 4 GB Ram, OSX 10,6.8 and Logic pro 9. i am wondering if you can help me out with the following problem i cant solve: when starting logic the following error appears: "sample-rate 55150 r