Help - Search - Members - Calendar
Full Version: Flash Script
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS-Submissions
anime4mage
Author - Malucifer
Original RMXP Tread Here

-Not recommended for Full Screen.-
-Warning you will need a Flash editor to put necessary Action Script-
-This means your Flash is original to you-

There are a lot of you that would like Flash put in with your game.
Not to mention that a flash file is small in size.

Well I asked a friend (malucifer) and he agreed it is beneficial to everyone here.

Download the Demo Here

All you Have to do is copy this code into Script Editor
Title it whateveruwant I called it Scene_Flash
CODE
$library_dir=(Dir.pwd).concat("/malib")

class Malib
def playFlash(fileName)
if(File.exist?((Dir.getwd).concat("/flash/").concat(fileName)))
tempDir=(0.chr)*255
Win32API.new("kernel32", "GetTempPath", ['L', 'P'], 'L').call(254, tempDir)
tempDir=tempDir.delete(0.chr)
tempDir=tempDir.tr("\\", "/")
filenum=1
tempFileDel=tempDir+"RMXPFS"+(filenum.to_s)+".maltmp"
while(File.exist?(tempFileDel))
filenum+=1
tempFileDel=tempDir+"RMXPFS"+(filenum.to_s)+".maltmp"
end#while
createTempFile=File.new(tempFileDel, "w+")
createTempFile.close
myLibShell=$library_dir+"/RMXPFlash.exe "+fileName
myLibShell+="malstrsplit"+tempFileDel
Win32API.new("kernel32", "WinExec", ['P', 'L'], 'L').call(myLibShell, 1)
flashWaitTimer=Thread.new do
loop do
if(File.exist?(tempFileDel))
Graphics.update
sleep(0.75)
else
flashWaitTimer.stop
end#if
end#loop
end#Thread
end#if
return
end#def
end#class
[Show/Hide] Example
Create two Folders
[ Malib ] & [ Flash ]
in your Game Directory
'MyDocument'/RM##/Project/'folders here'


Take(copy,move) 'RMXPFlash.exe' to the Malib Folder
#From the Demo or on the attachment here#


Now in the Flash Folder
Your Flash Projects go here (swf files)
You can delete the .fla files when you finish your game project
-If you don't your game will have a higher file size

##-!This is Necessary!-##
in your fla files (flash editing) you will have to put an action script on the first & last Frame.
First frame
CODE
fscommand("RMXPCommand", "nohang")

Last Frame
CODE
fscommand("flashFinished", "return")

Exact Character Keys and Capitalization required
##-!This is Necessary!-##

For 'last frame' you can use a button and put it anywhere in the frame timeline.
(if you make an arcade game and don't want to autoexit)
CODE
on (press) {fscommand("flashFinished", "return")}

See Step 4 on 2nd post for example
##---------------------------------------------------------------------------------------------##

OK to call a Flash Scene just call this script
CODE
(Malib.new).playFlash("intro.swf")
[Show/Hide] Example

Where intro.swf is the name of flash file plus its suffix.

To Call intro
In Script Editor on Main before begin call
CODE
(Malib.new).playFlash("intro.swf")

begin
  Graphics.freeze
.....
[Show/Hide] Example

##------------------------------------------------------------------------------------------------##

Download the Demo Here -or- Get exe & swf attachment here \/
anime4mage
If you want to embed a video to flash I recommend using Adobe Flash.

Import your movie file(avi,wmv,mpg,...) and a pop window will ask what to do?

Choose Embed Video[or Movie Clip] to SWF or whatever.

Choose the best Codec Conversions, I Recommend looking at the Movie Script Tread for Best Possible Conversions.

and convert.

Don't forget to put in the beginning and end Action Scripts





- I tried to be as informative as much as I can; Don't hate me -
cyon8785
Sorry to be a bother, but when RPG VX loads a flash movie
a window appears on the top left corner but disappears quickly so I cannot view its content is this a bug?
(except for this your RPG XP Flash player works perfectly fine)
anime4mage
QUOTE (cyon8785 @ May 9 2008, 07:53 AM) *
Sorry to be a bother, but when RPG VX loads a flash movie
a window appears on the top left corner but disappears quickly so I cannot view its content is this a bug?
(except for this your RPG XP Flash player works perfectly fine)
No I do not believe it is. It works on my VX just fine. I have found that if missplaced or mis-scripted can cause failure. try re-scripting it or ask malucifer.

This is probably because of the opens in new window 'thing' on original tread.
I do the same thing in movie script.

This happens because I think it has to load data in new window then close so it can play right.
This kind of file load is only playable on window mode[not full screen].

This is not my work, and Malucifer is still working on this script.
Elighja
Im going to try this script. Its exactly what i need so I really hope it works out great.
Elighja
Ok should I be able to run a flash vid anytime possible by calling it in an event? if so then its not working...
anime4mage
Did you use the 'call script' event to call -
(Malib.new).playFlash("intro.swf")

where 'intro.swf' is name of file

don't forget Action Scripts- and Scripts spelled and caracterized exactly
Elighja
Yes I used the call scrip in an vent. Do you think maybe you can post one or two screen shots showing how to properly call a video in an event?
anime4mage
You mean how to embed video?

Yes I will eventually get some snapshots posted.
maybe a week or two, in a update.

-converting video to swf is tricky-
anime4mage
Updated the Embedding video with picture tutorial's.
anime4mage
just a update added pic examples and a color coded html file to attachments, no more txt.

Html file can work with any browser.
ZaidoBlue23
can u make it full screen
while playing a Flash Movie
in RGSS Player?
Please fix it...
I hope that it will help to other people
and also to me.

QUOTE (anime4mage @ May 27 2008, 06:30 AM) *
just a update added pic examples and a color coded html file to attachments, no more txt.

Html file can work with any browser.


why are you advertising your website using signature!!!
Reported
anime4mage
QUOTE (ZaidoBlue23 @ Jun 5 2008, 06:18 AM) *
can u make it full screen
while playing a Flash Movie
in RGSS Player?
Please fix it...
I hope that it will help to other people
and also to me.


Unfortunatly I Can't make it work in full screen mode; in fact I can't/willnot decompile Malucifer's Libarary exe(MaLib.exe) to see what he did.


QUOTE (anime4mage @ May 27 2008, 06:30 AM) *
just a update added pic examples and a color coded html file to attachments, no more txt.

Html file can work with any browser.

It's an HTML file, like a worddoc, but usable in all computers: Mac,Unix,Windows.

QUOTE (ZaidoBlue23 @ Jun 5 2008, 06:18 AM) *
why are you advertising your website using signature!!!

Why not? I'll later use my site to post my Dev's and Graphic set's, Since I'm a developer and I'm not forcing anyone to join.

+Users are allowed to include a web site address in a signature, request comments on their personal site in a
social setting, or providing only once an interesting or relevant link to another site. -under Board Guidelines-
SasukeKun
Thanks for the script. I was looking for something like that. I will try it when my intro animation finished.
Yanazake
I tried to use the flash that came with the demo, but I couldn't call it.

By the way, is there any update for this script?
jedah vulture
Are you still working on it?
Is it possible to pass information from the rpg maker to flash ???
Thanks
Amechiki
I've just tested the intro video that plays at the beginning before the title screen, and I've found that if you click on the window, as if to move it, the title screen music will begin to play. It only plays if you click on the window though, if you sit back and watch the intro it's perfectly fine. But it seems like it would cause problems for people who would want to make a longer, more cinematic intro (like me =D)

sorry if I'm necro-posting.
Fina
QUOTE (Amechiki @ Apr 7 2009, 08:40 PM) *
I've just tested the intro video that plays at the beginning before the title screen, and I've found that if you click on the window, as if to move it, the title screen music will begin to play. It only plays if you click on the window though, if you sit back and watch the intro it's perfectly fine. But it seems like it would cause problems for people who would want to make a longer, more cinematic intro (like me =D)

sorry if I'm necro-posting.


This works perfectly in RPG Maker VX!!

I couldn't get two other video scripts to work, because my .avi file was too large and other formarts were clunky. But this worked great!

Saved my project.
Valdred
The file is temporarily unavailable. It's been so for a while. Could you re-upload?
rpgmakermaster
mm i have a question, can i use this script to play video on a skill in battle like a summoning???
kenth21v
QUOTE (anime4mage @ Apr 29 2008, 07:55 AM) *
Author - Malucifer
Original RMXP Tread Here

-Not recommended for Full Screen.-
-Warning you will need a Flash editor to put necessary Action Script-
-This means your Flash is original to you-

There are a lot of you that would like Flash put in with your game.
Not to mention that a flash file is small in size.

Well I asked a friend (malucifer) and he agreed it is beneficial to everyone here.

Download the Demo Here

All you Have to do is copy this code into Script Editor
Title it whateveruwant I called it Scene_Flash
CODE
$library_dir=(Dir.pwd).concat("/malib")

class Malib
   def playFlash(fileName)
    if(File.exist?((Dir.getwd).concat("/flash/").concat(fileName)))
      tempDir=(0.chr)*255
      Win32API.new("kernel32", "GetTempPath", ['L', 'P'], 'L').call(254, tempDir)
      tempDir=tempDir.delete(0.chr)
      tempDir=tempDir.tr("\\", "/")
      filenum=1
      tempFileDel=tempDir+"RMXPFS"+(filenum.to_s)+".maltmp"
     while(File.exist?(tempFileDel))
       filenum+=1
       tempFileDel=tempDir+"RMXPFS"+(filenum.to_s)+".maltmp"
     end#while
      createTempFile=File.new(tempFileDel, "w+")
      createTempFile.close
      myLibShell=$library_dir+"/RMXPFlash.exe "+fileName
      myLibShell+="malstrsplit"+tempFileDel
      Win32API.new("kernel32", "WinExec", ['P', 'L'], 'L').call(myLibShell, 1)
      flashWaitTimer=Thread.new do
      loop do
        if(File.exist?(tempFileDel))
          Graphics.update
          sleep(0.75)
        else
          flashWaitTimer.stop
        end#if
      end#loop
      end#Thread
    end#if
    return
  end#def
end#class
<div style="margin:20px; margin-top:5px"><div style="margin-bottom:2px">[Show/Hide] Example</div><div style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display: none;"></div></div></div>Create two Folders
[ Malib ] & [ Flash ]
in your Game Directory
'MyDocument'/RM##/Project/'folders here'


Take(copy,move) 'RMXPFlash.exe' to the Malib Folder
#From the Demo or on the attachment here#


Now in the Flash Folder
Your Flash Projects go here (swf files)
You can delete the .fla files when you finish your game project
-If you don't your game will have a higher file size

##-!This is Necessary!-##
in your fla files (flash editing) you will have to put an action script on the first & last Frame.
First frame
CODE
fscommand("RMXPCommand", "nohang")

Last Frame
CODE
fscommand("flashFinished", "return")

Exact Character Keys and Capitalization required
##-!This is Necessary!-##

For 'last frame' you can use a button and put it anywhere in the frame timeline.
(if you make an arcade game and don't want to autoexit)
CODE
on (press) {fscommand("flashFinished", "return")}

See Step 4 on 2nd post for example
##---------------------------------------------------------------------------------------------##

OK to call a Flash Scene just call this script
CODE
(Malib.new).playFlash("intro.swf")
<div style="margin:20px; margin-top:5px"><div style="margin-bottom:2px">[Show/Hide] Example</div><div style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display: none;"></div></div></div>
Where intro.swf is the name of flash file plus its suffix.

To Call intro
In Script Editor on Main before begin call
CODE
(Malib.new).playFlash("intro.swf")

begin
  Graphics.freeze
.....
<div style="margin:20px; margin-top:5px"><div style="margin-bottom:2px">[Show/Hide] Example</div><div style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display: none;"></div></div></div>
##------------------------------------------------------------------------------------------------##

Download the Demo Here -or- Get exe & swf attachment here \/



sori for a noobie question,
but is it possible to play a flash game inside the rpg maker xp?
i tried importing my flash presentation in rpg maker but when I click the button the flash already terminates smile.gif
i hope there is way. smile.gif
Night5h4d3
Its not likely to work, I believe all swf scripts only run the swf, and don't execute the actionscript.
kenth21v
QUOTE (Night5h4d3 @ Sep 8 2011, 12:32 PM) *
Its not likely to work, I believe all swf scripts only run the swf, and don't execute the actionscript.

oh dats bad.
uhm.. what about, how can i change the "clicking the button will stop the flash" into pressing enter instead?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.