Redoing the player in Flash
Moderators: EN - Assistant Moderators, EN - Forum Moderators
- henke37
- Security expert / tools programmer
- Posts: 3031
- Joined: Wed Mar 04, 2009 9:42 pm
- Gender: Male
- Spoken languages: Swedish,English
- Location: Sweden
- Contact:
Re: Redoing the player in Flash
Oh, I would like to do that. But I don't have the time to do it alone. And I simply can't draw.
Currently working on a redesign of Court-records.net.
- Singapore123
- Posts: 2085
- Joined: Wed May 05, 2010 8:56 am
- Gender: Male
- Spoken languages: English, 1337, french, spanish,
Re: Redoing the player in Flash
I mean that you just make a template WITH NO characters or story board. You can do you own design because it Unas choice for the design. Just show us a script or something.
AAO Pokemon RP, my pokemon team.
https://docs.google.com/document/d/1Mgs ... sp=sharing
https://docs.google.com/document/d/1Mgs ... sp=sharing
- henke37
- Security expert / tools programmer
- Posts: 3031
- Joined: Wed Mar 04, 2009 9:42 pm
- Gender: Male
- Spoken languages: Swedish,English
- Location: Sweden
- Contact:
Re: Redoing the player in Flash
A script or something? That's incredibly vague. What the player would have to do is mostly showing and hiding objects in response to the game script. Load some images, easy. Run a bitmap animation? Now that is something I can post.
Code: Select all
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class SpriteAnimator extends Sprite {
var bitmaps:Dictionary;
var loader:Loader;
var loading:SpritePicture;
var loadQueue:Vector.<SpritePicture>;
var picture:Bitmap;
var frame:int;
var frameDelay:uint;
var runAnim:SpriteAnimation;
var animation:SpriteAnimation;
public function SpriteAnimator() {
bitmaps=new Dictionary(true);
loadQueue=new Vector.<SpritePicture>();
var animFrames:Vector.<SpriteFrame>=new Vector.<SpriteFrame>();
for(var i:uint=1;i<=10;++i) {
loadQueue.push(
new SpritePicture(
new URLRequest(
i+".png"
),
i
)
);
}
animFrames.push(new SpriteFrame(1,3,-1,-3));//0
animFrames.push(new SpriteFrame(2,3, 0,-2));//1
animFrames.push(new SpriteFrame(3,3, 0, 0));//2
animFrames.push(new SpriteFrame(4,3,-2, 0));//3
animFrames.push(new SpriteFrame(5,3, 0,-3));//4
animFrames.push(new SpriteFrame(6,3, 0,-2));//5
animFrames.push(new SpriteFrame(7,3, 0, 0));//6
animFrames.push(new SpriteFrame(8,3,-1,-1));//7
animFrames.push(new SpriteFrame(9,3,-1,-1));//8
runAnim=new SpriteAnimation(animFrames,0);
picture=new Bitmap();
scaleX=scaleY=3;
addChild(picture);
processQueue();
}
private function processQueue():void {
loading=loadQueue.pop();
loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
loader.load(loading.request);
}
private function loaded(e:Event):void {
bitmaps[loading.id]=Bitmap(loader.content).bitmapData;
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,loaded);
if(loadQueue.length>0) {
processQueue();
} else {
startAnimation(runAnim);
}
}
private function startAnimation(a:SpriteAnimation):void {
frame=-1;
frameDelay=1;
animation=a;
addEventListener(Event.ENTER_FRAME,eFrame);
//stage.addEventListener("click",eFrame);
tick();
}
private function eFrame (e:Event):void {
frameDelay=1;
tick();
}
private function tick():void {
if(--frameDelay==0) {
++frame;
if(frame>=animation.cycle.length) {
if(animation.loopPoint==-1) {
removeEventListener(Event.ENTER_FRAME,eFrame);
} else {
frame=animation.loopPoint;
}
}
var spriteFrame=animation.cycle[frame];
picture.bitmapData=bitmaps[spriteFrame.id];
picture.x=spriteFrame.xOffset;
picture.y=spriteFrame.yOffset;
frameDelay=spriteFrame.delay;
trace(frame);
}
}
}
}
Currently working on a redesign of Court-records.net.
- Singapore123
- Posts: 2085
- Joined: Wed May 05, 2010 8:56 am
- Gender: Male
- Spoken languages: English, 1337, french, spanish,
Re: Redoing the player in Flash
O....K.......
(WHO CAN'T UNDERSTAND THAT!?)
(WHO CAN'T UNDERSTAND THAT!?)
AAO Pokemon RP, my pokemon team.
https://docs.google.com/document/d/1Mgs ... sp=sharing
https://docs.google.com/document/d/1Mgs ... sp=sharing
- henke37
- Security expert / tools programmer
- Posts: 3031
- Joined: Wed Mar 04, 2009 9:42 pm
- Gender: Male
- Spoken languages: Swedish,English
- Location: Sweden
- Contact:
Re: Redoing the player in Flash
It is quite simple:
- Load the images
- Each frame, check if the current image should be used, if so, decrement a counter
- If the counter reaches zero, show the next image and reset the counter
- If there is no next image, go back to the loop point if there is any
- If there is no loop point, stop the animation
Currently working on a redesign of Court-records.net.
- Singapore123
- Posts: 2085
- Joined: Wed May 05, 2010 8:56 am
- Gender: Male
- Spoken languages: English, 1337, french, spanish,
Re: Redoing the player in Flash
OK.....
I'm like this: right now.
I'm like this: right now.
AAO Pokemon RP, my pokemon team.
https://docs.google.com/document/d/1Mgs ... sp=sharing
https://docs.google.com/document/d/1Mgs ... sp=sharing
- Meph
- Posts: 13439
- Joined: Mon Nov 10, 2008 10:07 pm
- Gender: Male
- Spoken languages: English
- Location: Probably Disneyland Paris... or the UK
Re: Redoing the player in Flash
Canvas can do anything via script, whereas Flash can only do Flash content.Danielinhoni wrote:But... What are the features that Canvas has, that Flash Player hasn't? (POsitive features)
Turnabout Carjack | Secrets of a Turnabout
Unas's Birthday Bash (19th - 20th - 21st) | Franziska vs. Oldbag | Turnabout With a Theme
TGS Special Courtroom Session (2005 - 2006) | Turnabout Chill | Turnabout of the Wild West
- henke37
- Security expert / tools programmer
- Posts: 3031
- Joined: Wed Mar 04, 2009 9:42 pm
- Gender: Male
- Spoken languages: Swedish,English
- Location: Sweden
- Contact:
Re: Redoing the player in Flash
Name one thing that you think that Flash can not do that Canvas can. Or maybe I should start by introducing something that canvas doesn't do? Audio! The canvas element has no audio support what so ever.
Currently working on a redesign of Court-records.net.
- Meph
- Posts: 13439
- Joined: Mon Nov 10, 2008 10:07 pm
- Gender: Male
- Spoken languages: English
- Location: Probably Disneyland Paris... or the UK
Re: Redoing the player in Flash
Because it doesn't need audio support, because the audio element can do it.henke37 wrote:The canvas element has no audio support what so ever.
I'll give you something that the Flash Player can do that canvas can't: crash.
Turnabout Carjack | Secrets of a Turnabout
Unas's Birthday Bash (19th - 20th - 21st) | Franziska vs. Oldbag | Turnabout With a Theme
TGS Special Courtroom Session (2005 - 2006) | Turnabout Chill | Turnabout of the Wild West
- henke37
- Security expert / tools programmer
- Posts: 3031
- Joined: Wed Mar 04, 2009 9:42 pm
- Gender: Male
- Spoken languages: Swedish,English
- Location: Sweden
- Contact:
Re: Redoing the player in Flash
That is because you are comparing an implementation with a technology. If you do a correct comparison, you will find that both the flash player and various browsers implementing the canvas element can crash.
Currently working on a redesign of Court-records.net.
- Meph
- Posts: 13439
- Joined: Mon Nov 10, 2008 10:07 pm
- Gender: Male
- Spoken languages: English
- Location: Probably Disneyland Paris... or the UK
Re: Redoing the player in Flash
Amusing that it is a good browser, the script engine can crash, but not the canvas element itself. The browser won't lose performance.
But you're right. That's a bad argument.
As good argument is that Canvas is open source, can be changed to use any context (so Adobe could make their own if they wanted to), and can more easily interact with JavaScript on the page.
In 10 years time, Canvas will most likely be more widely used.
But you're right. That's a bad argument.
As good argument is that Canvas is open source, can be changed to use any context (so Adobe could make their own if they wanted to), and can more easily interact with JavaScript on the page.
In 10 years time, Canvas will most likely be more widely used.
Turnabout Carjack | Secrets of a Turnabout
Unas's Birthday Bash (19th - 20th - 21st) | Franziska vs. Oldbag | Turnabout With a Theme
TGS Special Courtroom Session (2005 - 2006) | Turnabout Chill | Turnabout of the Wild West
- henke37
- Security expert / tools programmer
- Posts: 3031
- Joined: Wed Mar 04, 2009 9:42 pm
- Gender: Male
- Spoken languages: Swedish,English
- Location: Sweden
- Contact:
Re: Redoing the player in Flash
No one is ever going to make their own context. There is nothing to gain from it.
While you do have a point in that the canvas element having easy javascript access, I strongly reject the claim that flash is harder to interact with. Just look at this example Besides, with the full player in Flash, the point is irrelevant.
As for open source, it is overrated. And the Flash compiler is open source. And parts of the player uses open source code too. No, it is not the full player, but honestly, no one cares.
And canvas being the most used of them? Ha. Just ha.
Btw, the whole prototype system in JavaScript should be tossed in the garbage can. It is a disadvantage that Flash actually kept it in the new vm. And even then, it is just for compatibility, compatibility with nothing.
While you do have a point in that the canvas element having easy javascript access, I strongly reject the claim that flash is harder to interact with. Just look at this example Besides, with the full player in Flash, the point is irrelevant.
As for open source, it is overrated. And the Flash compiler is open source. And parts of the player uses open source code too. No, it is not the full player, but honestly, no one cares.
And canvas being the most used of them? Ha. Just ha.
Btw, the whole prototype system in JavaScript should be tossed in the garbage can. It is a disadvantage that Flash actually kept it in the new vm. And even then, it is just for compatibility, compatibility with nothing.
Currently working on a redesign of Court-records.net.
Re: Redoing the player in Flash
All these potential changes... but is the way we use the Trial Maker still the same? As in, we just have to pick a background, profile put int he text etc? We wont have to do all that script stuff... will we?
- Meph
- Posts: 13439
- Joined: Mon Nov 10, 2008 10:07 pm
- Gender: Male
- Spoken languages: English
- Location: Probably Disneyland Paris... or the UK
Re: Redoing the player in Flash
Yes. It's just a backend change that allows for better improvements.Nevfx wrote:All these potential changes... but is the way we use the Trial Maker still the same? As in, we just have to pick a background, profile put int he text etc? We wont have to do all that script stuff... will we?
I could just as much argue that Flash is over-rated. That point is irrelevant.henke37 wrote:As for open source, it is overrated.
Turnabout Carjack | Secrets of a Turnabout
Unas's Birthday Bash (19th - 20th - 21st) | Franziska vs. Oldbag | Turnabout With a Theme
TGS Special Courtroom Session (2005 - 2006) | Turnabout Chill | Turnabout of the Wild West
- henke37
- Security expert / tools programmer
- Posts: 3031
- Joined: Wed Mar 04, 2009 9:42 pm
- Gender: Male
- Spoken languages: Swedish,English
- Location: Sweden
- Contact:
Re: Redoing the player in Flash
The editor can indeed be done in javascript. It works fine as it is. I have ideas, but there is no need to replace the editor, it is fine.
Currently working on a redesign of Court-records.net.