PDA

View Full Version : A question i want to ask for general actionscripting !!!!



lambros
June 22nd, 2007, 06:46 AM
look i am trying to learn how to use actionscript 3. i see the codes and sometimes i do get their pooint sometimes nope.

i can create buttons and some other things with actionscript 3 and i can create a basic webssite apart from the preloader.(which i hope you are going to help me pn my other topic)

now for my question.
what is the purpose and the use of packages and classes like this code

package
{
import flash.display.Sprite;
public class Starter_2 extends Sprite
{
public function Starter_2 ()
{
myTest();
}
private function myTest():void
{
var a:Suplemental_1 = new Suplemental_1 ();
a.thisTest ();
addChild(a);
}
}
}
import flash.display.Sprite;
import flash.text.TextField;
class Suplemental_1 extends Sprite
{
private var tField:TextField;
public function Suplemental_1 ()
{
}
public function thisTest ():void
{
tField = new TextField();
tField.autoSize = "left";
tField.background = true;
tField.border = true;
tField.x = 200;
tField.y = 200;
tField.text = "Hello You, what is your name?";
addChild(tField);
}
}

when we can manually add the textfield and customize it as we want through flash with the tools etc.... i found a lot , almost all codes aropund are with these packages that try to import objects and things....why can't we just place them import them and use their instances names for scripting ?????? if i want to import them through the tools how can i script them to work like the packages do ?

i hope you giot the point of my question and i am waititng for your answers!!!

ecptavares
June 22nd, 2007, 08:20 AM
I am not good in actionscript neither but I am trying to learn and our friends will help me out if I am mistaking. AS3 now is class based.Althought you could simply construct your site inside flash enviroment, the best practice would be make a class and put it inside a package so you can use it for more than one project(maybe just do a little changes to fit but not much of a work to do later). Of course there might be more to it but like I said , I am still learning.

Hope to help you a little bit and correct me if I am wrong please.

lambros
June 22nd, 2007, 09:57 AM
oh i got your point...you mean like just putting the classes and packages into an actionscript file and just import it to other projects too....
hmmmm well this is a good advantage but flash has way to much tools and this way most of them get ignored....i think that it will be awsome if someone make a video tutorial or a book like those at lynda.com or cartoonsmart that describe how to use the tools for adding the objects and the related actionscripts to them for easier coding . cause now everyone is trying to learn the packages in whole and there isn't anywhere a guidance for the tools too....