Great video! Very usefull and you teach very well. Started using flash and AS right before watch the video, and now I feel like I can do anything xD Thanks!
@Djentard You don't have to be working in Flash to make use of a lot of this stuff. The only downside of working in Flex is that you lose the timeline - you can import graphics from outside though, yes. You could go look up Embed in as3 as there are plenty of tutorials out there on it. You could also look at various engines that help with it all - like Flixel
@larsellars Make sure your Ship.as file is saved in the same folder as your .fla. Also, make sure your library symbol for the ship is export as Ship - right click on it in the library and go to properties or linkage and make sure Class says Ship
this is great bro .... i learn a lot of new concepts from watching ur vids .... would u by chance have any videos demonstrating hittests with irregular objects ?
@vfxenchor Basically, you just remove the event listener for the Event.ENTER_FRAME function in the level. That's why all the classes have an update function instead of their own listeners. So, make a pause button that removes the listener and an unpause button to add it back (or one to toggle!)
@ibrahimahmed1996 Which API? You can import any ActionScript or SWC stuff you like. If you're after specific things you might want to look at frameworks like starling - or Flixel/Flashpunk and so on
You don't necessarily need a document class. Until you specify a document class in the .fla properties, the timeline is the document class, so programs work just fine without any .as files at all
You don't have to be working in Flash to make use of a lot of this stuff. The only downside of working in Flex is that you lose the timeline - you can import graphics from outside though, yes. You could go look up Embed in as3 as there are plenty of tutorials out there on it. You could also look at various engines that help with it all - like Flixel
First of all, thanks for the tutorial! I need some help here... when a select my ship and go to "Modify", "Convert to Symbol", set it's type as Movie Clip, and check the linkage box for "Export for ActionScript", I do change the Base class to "flash.display.Sprite", but when i click on the pencil to "Edit class definition", an error message pop up in my window warning : "A definition for this class could not be in the classpath, so one will be automatically generated in the SWF file upon export
I have the same problem, ships do not move (i put i trace event within the function and this was returned in the output. so why do the ships not move?)
In that case it looks like your ball instance and your ball class have the same name, which causes problems. In general, the class name should start with an upper case letter. So Ball should be your class and you could have an instance called ball, which would work just fine
@PointClickWin I made a stupid mistake and wrote sprite not Sprite. Yet the trouble isn't over the new error is: 1046: Type was not found or was not a compile-time constant: Ship. I have used half a hour trying to troubleshoot it my self but i cand't seem to find the mistake.
Are your .as file and your .fla in the same place? I can't imagine why it wouldn't trace if so. Have you got an instance of the ship on the stage? There are a few tutorials on my site that have sample files containing .fla and .as together if you want to try them - the pathfinding or random hills tutorials, for example.
@larsellars Hmm... sounds like you haven't imported flash.display.Sprite in your Ship.as file - check the top few lines and make sure the actual class line says 'extends Sprite' and not 'extends MovieClip' Go back a few seconds and double check every line; if you had Flash generate the class for you (by pushing the pencil button) then it will have imported MovieClip instead of Sprite by default
Is there a way to set the rotation in the .as file? I've got a program similar to the one in the video, and my code says: ball.rotation = 45 But I keep getting error: 1119: Access of possibly undefined property rotation through a reference with static type Class.
@PointClickWin Question: Do i really need the Adobe Flash Builder to make a full flash game? Because i don't really wanna pay 600-ish € just to test how hard it is to make a flash game. (I know it has a trail but...). I use the Adobe Flex SDK that came with FlashDevelop. I guess it's possible to actually draw by code itself in Flex. And importing the sprites and stuff from another program instead of making them in flash builder is possible, right?
09:58 When I am testing it it the trace "made a ship!" doesn't show it says: "The defination of base class sprite was not found" "The class 'Ship' must subclass 'flash.display.movieclip' since it is linked to a library of that type" I double checked everything but i dont see why this is. Is my class propertis wrong or mabey my properties, but they are exacly the same. Please help!
Mr.PointClickWin i'm studying your videos and making the same work until i reached video n°18, with tweens motions, i never had problems until that video!!! Can you help me i reached minute 13:56 of the 18th video and you had same problem but changing the code on the game.as you solved it! While i'm still here and completed that video and that code until end, I dont get any errors and i still have black screen! I can only avoid it on flash player by making "reproduce" and not circle HELP tnx.
is it ok if im using cs5? cause ive got an error message on part 4 "creating bullets" and im starting again, im guessing that ive got something wrong and hopefully it isnt about the version.
Sounds like you might be in CS4, which doesn't make a class for you when you click the pencil. You'll need to go file -> new and choose ActionScript file. Make your own version of the class and save it in the same place as your .fla That should work!
I watched this series back in 2012 when I first started programming in actionscript and decided to get back into as3 again so I'm gonna rewatch this series as a bit of a refresher! Looking back and at the time, I almost wish I started with Unity instead of flash seeing as Unity is pretty much compatible across all platforms where as flash is kinda laggy on devices and Unity has way more tutorials now, which makes it easier to learn. With that said, I still think flash holds it's own in the 2d game making world and I'd never have the time to make 3d games anyways. Times sure have changed.. @PointClickWin do you still program in as3 at all or have you moved onto Unity? (Noticed your newer vids were for Unity)
I only teach Unity now but Flash will always have a place in my heart! It’s not so hard jumping between the 2, so your time in Flash/Animate hasn’t been wasted. I’d like to get a few more Unity bits on the channel in future - will have to see if time permits it.
this is the continue of the scrpit: function update(e:Event) { x=x+Math.cos(rotation/180*Math.PI)*speed; y=y+Math.sin(rotation/180*Math.PI)*speed; } } } why doesn't it works?
PointClick can u help me please, i'm stopped at video 18 and i get black screen i sent some messages to you, tell me if i can add u as friend i dont know how
Is your library object definitely called ship and not Ship? The capital letter makes all the difference. As a general rule, your classes should always start with upper case letters
Sorry for the disturn to help for my problem but i get up 1 hour ago and do the same code for second time but now succesfull!!! i recognized my error was to type: "lenght" and not as it must be "length" !!!!!!!!! MY GOD A SPELLING ERROR TOOK ME ABOUT 2 DAYS OF CONCENTRATION :( thanks pointclick same to create those fantastic video collection of as3 RLY TNX, if i have other problems i will contact u i hope with answer this time :)
@KillerPenguin98 //functions function Ship() { //This is a constructer. This is what happens when a ship is made. speed=2+Math.random()*5; trace("Made A Ship!") //add an event listener tp update every frame addEventListener(Event.ENTER_FRAME, update); } function update(e:Event) { x=x+Math.cos(rotation/180*Math.PI)*speed; y=y+Math.sin(rotation/180*Math.PI)*speed; } } } the ships dont move is there something wrong
Odd :( It could be a problem linking the files to your .fla. If you File -> Save as and save it as CS5.5 you can email me it for a look if you like. Email is on my site
package { // import any necessary files/libraries import flash.display.Sprite; import flash.events.Event; // make the class public class Ship extends Sprite { // tell the class what properties it has private var speed:int; // functions function Ship() { // This is the constructor. This happens when a Ship is made. speed=5; trace("Made a Ship!"); // add on event listener to update every frame addEventListener(Event.ENTER_FRAME, update); }
It's very hard to tell from that, I'd need to see the project really. You can email me (address is on my site through the channel) and I'll take a look when I get some time
the code is package{ //import any necessary files/libraries import flash.display.Sprite import flash.events.Event //create class public class Ship extends Sprite{//tell the class what properties it hasprivate var speed:int;//functionsfunction Ship(){//this constructer happens when a Ship ismadespeed=5;trace("Made a Ship!")//add an event listener tp update every frame addEventListener(Event.ENTER_FRAME, update);}function update(e:Event){ i erased the x=x math.....
package { // import any necessary files/libraries import flash.display.Sprite; import flash.events.Event; //make the class public class Ship extends Sprite{ //tell the clase what properties it has private var speed:int;
Mr.PointClickWin i'm studying your videos and making the same work until i reached video n°18, with tweens motions, i never had problems until that video!!! Can you help me i reached minute 13:56 of the 18th video and you had same problem but changing the code on the game.as you solved it! While i'm still here and completed that video and that code until end, I dont get any errors and i still have black screen! I can only avoid it on flash player by making "reproduce" and not circle HELP tnx.
I've already used these tutorials to make a game but I'm coming back to review what I learned. That's how good these are.
Great video! Very usefull and you teach very well.
Started using flash and AS right before watch the video, and now I feel like I can do anything xD
Thanks!
awesome. it is easy to understand. very helpful.
@Djentard You don't have to be working in Flash to make use of a lot of this stuff. The only downside of working in Flex is that you lose the timeline - you can import graphics from outside though, yes. You could go look up Embed in as3 as there are plenty of tutorials out there on it. You could also look at various engines that help with it all - like Flixel
@larsellars Make sure your Ship.as file is saved in the same folder as your .fla. Also, make sure your library symbol for the ship is export as Ship - right click on it in the library and go to properties or linkage and make sure Class says Ship
this is great bro .... i learn a lot of new concepts from watching ur vids .... would u by chance have any videos demonstrating hittests with irregular objects ?
@vfxenchor Basically, you just remove the event listener for the Event.ENTER_FRAME function in the level. That's why all the classes have an update function instead of their own listeners. So, make a pause button that removes the listener and an unpause button to add it back (or one to toggle!)
@ibrahimahmed1996 Which API? You can import any ActionScript or SWC stuff you like. If you're after specific things you might want to look at frameworks like starling - or Flixel/Flashpunk and so on
You don't necessarily need a document class. Until you specify a document class in the .fla properties, the timeline is the document class, so programs work just fine without any .as files at all
@larsellars Failing that, go to your library, right click on the Ship and go to properties and make sure the 'Base class' says flash.display.Sprite
@bioskok They're just as cos and sin in maths class or on a calculator. I'll try to explain them in a bit more detail in future!
@TheAdsClan Afraid not, I haven't saved the code video by video but I'll probably upload the final result when it's all done
Love your videos!
:) I'm glad you like it! Personally, I prefer the newer stuff on my site - a lot of this series makes me cringe ;)
You'll have to simulate gravity, yes. I don't think I've directly covered that in this series but there are plenty of bouncing tutorials out there
You don't have to be working in Flash to make use of a lot of this stuff. The only downside of working in Flex is that you lose the timeline - you can import graphics from outside though, yes. You could go look up Embed in as3 as there are plenty of tutorials out there on it. You could also look at various engines that help with it all - like Flixel
First of all, thanks for the tutorial!
I need some help here... when a select my ship and go to "Modify", "Convert to Symbol", set it's type as Movie Clip, and check the linkage box for "Export for ActionScript", I do change the Base class to "flash.display.Sprite", but when i click on the pencil to "Edit class definition", an error message pop up in my window warning : "A definition for this class could not be in the classpath, so one will be automatically generated in the SWF file upon export
I have the same problem, ships do not move (i put i trace event within the function and this was returned in the output. so why do the ships not move?)
In that case it looks like your ball instance and your ball class have the same name, which causes problems. In general, the class name should start with an upper case letter. So Ball should be your class and you could have an instance called ball, which would work just fine
@PointClickWin
I made a stupid mistake and wrote sprite not Sprite.
Yet the trouble isn't over the new error is: 1046: Type was not found or was not a compile-time constant: Ship.
I have used half a hour trying to troubleshoot it my self but i cand't seem to find the mistake.
Are your .as file and your .fla in the same place? I can't imagine why it wouldn't trace if so. Have you got an instance of the ship on the stage? There are a few tutorials on my site that have sample files containing .fla and .as together if you want to try them - the pathfinding or random hills tutorials, for example.
@larsellars Hmm... sounds like you haven't imported flash.display.Sprite in your Ship.as file - check the top few lines and make sure the actual class line says 'extends Sprite' and not 'extends MovieClip'
Go back a few seconds and double check every line; if you had Flash generate the class for you (by pushing the pencil button) then it will have imported MovieClip instead of Sprite by default
Is there a way to set the rotation in the .as file? I've got a program similar to the one in the video, and my code says:
ball.rotation = 45
But I keep getting error: 1119: Access of possibly undefined property rotation through a reference with static type Class.
@PointClickWin Question: Do i really need the Adobe Flash Builder to make a full flash game? Because i don't really wanna pay 600-ish € just to test how hard it is to make a flash game. (I know it has a trail but...).
I use the Adobe Flex SDK that came with FlashDevelop. I guess it's possible to actually draw by code itself in Flex. And importing the sprites and stuff from another program instead of making them in flash builder is possible, right?
Ship.as, Line 22 1046: Type was not found or was not a compile-time constant: Event.
How do I fix this??
very good video ,I speak spanish but I understood everything
It looks like you haven't imported the Event class. Make sure you have import flash.events.Event; underneath the package line in the .as file
09:58
When I am testing it it the trace "made a ship!" doesn't show it says:
"The defination of base class sprite was not found"
"The class 'Ship' must subclass 'flash.display.movieclip' since it is linked to a library of that type"
I double checked everything but i dont see why this is. Is my class propertis wrong or mabey my properties, but they are exacly the same.
Please help!
I'm using Adobe Flash CS3 Professional.
Sorry if it's an early doubt.
What if i want the turret to move? what code where do i paste?
why not use movieclip? I always make little animations and stuff in movieclips and you cant do that with a sprite
help i am using flash pro CC and the ship is not moving please reply
@bioskok yup yup!
what is the error message?
Mr.PointClickWin i'm studying your videos and making the same work until i reached video n°18, with tweens motions, i never had problems until that video!!!
Can you help me i reached minute 13:56 of the 18th video and you had same problem but changing the code on the game.as you solved it! While i'm still here and completed that video and that code until end, I dont get any errors and i still have black screen! I can only avoid it on flash player by making "reproduce" and not circle HELP tnx.
is it ok if im using cs5? cause ive got an error message on part 4 "creating bullets" and im starting again, im guessing that ive got something wrong and hopefully it isnt about the version.
Is this for who just finished watching your ''Programming with ActionScript 3'' tutorials :)?
Sounds like you might be in CS4, which doesn't make a class for you when you click the pencil. You'll need to go file -> new and choose ActionScript file. Make your own version of the class and save it in the same place as your .fla
That should work!
I watched this series back in 2012 when I first started programming in actionscript and decided to get back into as3 again so I'm gonna rewatch this series as a bit of a refresher! Looking back and at the time, I almost wish I started with Unity instead of flash seeing as Unity is pretty much compatible across all platforms where as flash is kinda laggy on devices and Unity has way more tutorials now, which makes it easier to learn. With that said, I still think flash holds it's own in the 2d game making world and I'd never have the time to make 3d games anyways. Times sure have changed..
@PointClickWin do you still program in as3 at all or have you moved onto Unity? (Noticed your newer vids were for Unity)
I only teach Unity now but Flash will always have a place in my heart! It’s not so hard jumping between the 2, so your time in Flash/Animate hasn’t been wasted.
I’d like to get a few more Unity bits on the channel in future - will have to see if time permits it.
this is the continue of the scrpit:
function update(e:Event) {
x=x+Math.cos(rotation/180*Math.PI)*speed;
y=y+Math.sin(rotation/180*Math.PI)*speed;
}
}
}
why doesn't it works?
Indeed thank you.
PointClick can u help me please, i'm stopped at video 18 and i get black screen i sent some messages to you, tell me if i can add u as friend i dont know how
Is your library object definitely called ship and not Ship? The capital letter makes all the difference. As a general rule, your classes should always start with upper case letters
Should I know what the ''Math''.. ''cos'' and ''sin'' commands do by now? I understand what your doing but those commands.. I got no idea :(
thanks again. i will do this :)
Sorry for the disturn to help for my problem but i get up 1 hour ago and do the same code for second time but now succesfull!!!
i recognized my error was to type: "lenght" and not as it must be "length" !!!!!!!!! MY GOD A SPELLING ERROR TOOK ME ABOUT 2 DAYS OF CONCENTRATION :( thanks pointclick same to create those fantastic video collection of as3 RLY TNX, if i have other problems i will contact u i hope with answer this time :)
@KillerPenguin98 Feels good fixing your own stuff doesn't it? :)
please tell me whats wrong with the code
function update(e.Event) should be a colon instead of a dot. function update(e:Event)
@KillerPenguin98 //functions
function Ship() {
//This is a constructer. This is what happens when a ship is made.
speed=2+Math.random()*5;
trace("Made A Ship!")
//add an event listener tp update every frame
addEventListener(Event.ENTER_FRAME, update);
}
function update(e:Event) {
x=x+Math.cos(rotation/180*Math.PI)*speed;
y=y+Math.sin(rotation/180*Math.PI)*speed;
}
}
}
the ships dont move is there something wrong
Odd :(
It could be a problem linking the files to your .fla. If you File -> Save as and save it as CS5.5 you can email me it for a look if you like. Email is on my site
package {
// import any necessary files/libraries
import flash.display.Sprite;
import flash.events.Event;
// make the class
public class Ship extends Sprite {
// tell the class what properties it has
private var speed:int;
// functions
function Ship() {
// This is the constructor. This happens when a Ship is made.
speed=5;
trace("Made a Ship!");
// add on event listener to update every frame
addEventListener(Event.ENTER_FRAME, update);
}
It's very hard to tell from that, I'd need to see the project really.
You can email me (address is on my site through the channel) and I'll take a look when I get some time
@PointClickWin Okay thanks :D!
@PointClickWin Thank you :)
Cheers.
ohh ok thanks :D
make sure that the AS linkage is "Ship"
and not "ship"
the code is
package{
//import any necessary files/libraries
import flash.display.Sprite
import flash.events.Event
//create class
public class Ship extends Sprite{//tell the class what properties it hasprivate var speed:int;//functionsfunction Ship(){//this constructer happens when a Ship ismadespeed=5;trace("Made a Ship!")//add an event listener tp update every frame addEventListener(Event.ENTER_FRAME, update);}function update(e:Event){
i erased the x=x math.....
same
@Magus1508 :)
@PointClickWin very
package {
// import any necessary files/libraries
import flash.display.Sprite;
import flash.events.Event;
//make the class
public class Ship extends Sprite{
//tell the clase what properties it has
private var speed:int;
@IAmSEANN27 If he's creative enough he can make fun stuff without ever doing so much as 2+2!
@KillerPenguin98 never Mind
Mr.PointClickWin i'm studying your videos and making the same work until i reached video n°18, with tweens motions, i never had problems until that video!!!
Can you help me i reached minute 13:56 of the 18th video and you had same problem but changing the code on the game.as you solved it! While i'm still here and completed that video and that code until end, I dont get any errors and i still have black screen! I can only avoid it on flash player by making "reproduce" and not circle HELP tnx.