Page 1 of 1

Easily make your own animated flash movie from PB

Posted: Tue Mar 03, 2009 3:09 pm
by ricardo
Thanks to Kiffi and srod help i finally find the errors on my code and now we can make flash movies from PB, in a very easy way.

Download and register the bukoo dll (im hosting it because cant find it online anymore since the sourceforge project seams to be dead) http://yenerich.com/swfobjs.rar
*I hope this dll can be hosted on PuraArea to avoid the risk of broken links, just a suggestion.


Example:

Code: Select all

IncludePath "..\"
XIncludeFile "COMate.pbi"

Define Movie.COMateObject 
Define pic.COMateObject 
Define MyFont.COMateObject
Define Texto.COMateObject 
Define MyRectangle.COMateObject

Fname.s =  "PureBasicTest.swf" 

;Make the main movie
Movie = COMate_CreateObject("swfobjs.swfMovie") 

Movie\Invoke("SetSize(5325, 6000)") 
Movie\Invoke("SetFrameBkColor(255, 255, 255)") 
Movie\Invoke("SetFrameRate(20)") 


MyRectangle = COMate_CreateObject("swfobjs.swfObject") 
MyRectangle\Invoke("MakeRectangle(0, 0, 4000, 4680)")
MyRectangle\Invoke("SetRadialFill(255, 255, 255, 255, 255, 50, 224, 255)")
MyRectangle\Invoke("SetRadialFillCenter (3190, 1895)")
MyRectangle\Invoke("SetDepth(0)")

Debug COMate_GetLastErrorDescription() 
Movie\Invoke("AddObject(" + Str(MyRectangle) + " As COMateObject)")

For i = 1 To 200
  Movie\Invoke("GotoFrame(" + Str(i) + ")")
  Movie\Invoke("RemoveObject(" + Str(MyRectangle) + " As COMateObject)")
  MyRectangle\Invoke("Rotate(" + Str(655360 * i) + ")")
  Movie\Invoke("AddObject(" + Str(MyRectangle) + " As COMateObject)")
Next


;We create a font
MyFont = COMate_CreateObject("swfobjs.swfObject") 

MyFont\Invoke("MakeFont('Arial')")

;We create the text 
Texto = COMate_CreateObject("swfobjs.swfObject")

Letra$ = "PureBasic"

MyFont\Invoke("AddGlyph('Arial', '" + Letra$ + "', " + Str(Asc("" + Letra$ + "")) + ")")

Texto\Invoke("MakeTextEx('" + Letra$ + "', " + Str(MyFont) + "  As COMateObject, 10, 2650, 800)")
Texto\Invoke("SetSolidFill(100, 0, 100, 100)")
Movie\Invoke("GotoFrame(20)")
Movie\Invoke("AddObject(" + Str(Texto) + " As COMateObject)")

For i = 50 To 400
  Movie\Invoke("GotoFrame(" + Str(i) + ")")
  Movie\Invoke("RemoveObject(" + Str(Texto) + " As COMateObject)")
  Texto\Invoke("Rotate(" + Str(-655360 * i) + ")")
  Texto\Invoke("Scale(" + Str(655 * (i*2)) + "," + Str(655 * (i*2)) + ")")
  Movie\Invoke("AddObject(" + Str(Texto) + " As COMateObject)")
Next

Movie\Invoke("AddObject(" + Str(Texto) + " As COMateObject)") 


Movie\Invoke("WriteMovie('" + Fname + "')")
I know many of you will have much fun playing with this :)

Posted: Tue Mar 03, 2009 3:17 pm
by ricardo
A very small addition, that changes the color of the text on runtime

Code: Select all

IncludePath "..\"
XIncludeFile "COMate.pbi"

Define Movie.COMateObject 
Define pic.COMateObject 
Define MyFont.COMateObject
Define Texto.COMateObject 
Define MyRectangle.COMateObject

Fname.s =  "PureBasicTest.swf" 

;Make the main movie
Movie = COMate_CreateObject("swfobjs.swfMovie") 

Movie\Invoke("SetSize(5325, 6000)") 
Movie\Invoke("SetFrameBkColor(255, 255, 255)") 
Movie\Invoke("SetFrameRate(20)") 


MyRectangle = COMate_CreateObject("swfobjs.swfObject") 
MyRectangle\Invoke("MakeRectangle(0, 0, 4000, 4680)")
MyRectangle\Invoke("SetRadialFill(255, 255, 255, 255, 255, 50, 224, 255)")
MyRectangle\Invoke("SetRadialFillCenter (3190, 1895)")
MyRectangle\Invoke("SetDepth(0)")

Debug COMate_GetLastErrorDescription() 
Movie\Invoke("AddObject(" + Str(MyRectangle) + " As COMateObject)")

For i = 1 To 200
  Movie\Invoke("GotoFrame(" + Str(i) + ")")
  Movie\Invoke("RemoveObject(" + Str(MyRectangle) + " As COMateObject)")
  MyRectangle\Invoke("Rotate(" + Str(655360 * i) + ")")
  Movie\Invoke("AddObject(" + Str(MyRectangle) + " As COMateObject)")
Next


;We create a font
MyFont = COMate_CreateObject("swfobjs.swfObject") 

MyFont\Invoke("MakeFont('Arial')")

;We create the text 
Texto = COMate_CreateObject("swfobjs.swfObject")

Letra$ = "PureBasic"

MyFont\Invoke("AddGlyph('Arial', '" + Letra$ + "', " + Str(Asc("" + Letra$ + "")) + ")")

Texto\Invoke("MakeTextEx('" + Letra$ + "', " + Str(MyFont) + "  As COMateObject, 10, 2650, 800)")
Texto\Invoke("SetSolidFill(100, 0, 100, 100)")
Movie\Invoke("GotoFrame(20)")
Movie\Invoke("AddObject(" + Str(Texto) + " As COMateObject)")

For i = 50 To 400
  Movie\Invoke("GotoFrame(" + Str(i) + ")")
  Movie\Invoke("RemoveObject(" + Str(Texto) + " As COMateObject)")
  Texto\Invoke("SetSolidFill(100, " + Str(i*2) + ", 100, 100)") ; <<<<<<<<
  Texto\Invoke("Rotate(" + Str(-655360 * i) + ")")
  Texto\Invoke("Scale(" + Str(655 * (i*2)) + "," + Str(655 * (i*2)) + ")")
  Movie\Invoke("AddObject(" + Str(Texto) + " As COMateObject)")
Next

Movie\Invoke("AddObject(" + Str(Texto) + " As COMateObject)") 


Movie\Invoke("WriteMovie('" + Fname + "')")

Posted: Tue Mar 03, 2009 6:36 pm
by ricardo
Another addition, when clicking the "purebasic" text it will open a webpage

Code: Select all

IncludePath "..\"
XIncludeFile "COMate.pbi"

Define Movie.COMateObject 
Define pic.COMateObject 
Define MyFont.COMateObject
Define Texto.COMateObject 
Define MyRectangle.COMateObject
Define ActionButton.COMateObject
Define MyAction.COMateObject

Fname.s =  "PureBasicTest.swf" 

;Make the main movie
Movie = COMate_CreateObject("swfobjs.swfMovie") 

Movie\Invoke("SetSize(5325, 6000)") 
Movie\Invoke("SetFrameBkColor(255, 255, 255)") 
Movie\Invoke("SetFrameRate(20)") 


MyRectangle = COMate_CreateObject("swfobjs.swfObject") 
MyRectangle\Invoke("MakeRectangle(0, 0, 4000, 4680)")
MyRectangle\Invoke("SetRadialFill(255, 255, 255, 255, 255, 50, 224, 255)")
MyRectangle\Invoke("SetRadialFillCenter (3190, 1895)")
MyRectangle\Invoke("SetDepth(0)")


Movie\Invoke("AddObject(" + Str(MyRectangle) + " As COMateObject)")

For i = 1 To 400
  Movie\Invoke("GotoFrame(" + Str(i) + ")")
  Movie\Invoke("RemoveObject(" + Str(MyRectangle) + " As COMateObject)")
  MyRectangle\Invoke("Rotate(" + Str(655360 * i) + ")")
  Movie\Invoke("AddObject(" + Str(MyRectangle) + " As COMateObject)")
Next


;We create a font
MyFont = COMate_CreateObject("swfobjs.swfObject") 

MyFont\Invoke("MakeFont('Arial')")

;We create the text 
Texto = COMate_CreateObject("swfobjs.swfObject")
Letra$ = "PureBasic"
MyFont\Invoke("AddGlyph('Arial', '" + Letra$ + "', " + Str(Asc("" + Letra$ + "")) + ")")

Texto\Invoke("MakeTextEx('" + Letra$ + "', " + Str(MyFont) + "  As COMateObject, 10, 2650, 800)")
Texto\Invoke("SetSolidFill(100, 0, 100, 100)")
Movie\Invoke("GotoFrame(20)")
Movie\Invoke("AddObject(" + Str(Texto) + " As COMateObject)")

;Lets add an action to a text!
ActionButton = COMate_CreateObject("swfobjs.swfObject")
MyAction = COMate_CreateObject("swfobjs.swfAction")

ActionButton\Invoke("MakeButtonSimple(" + Str(Texto) + "  As COMateObject, 0, 0, 255, 0, 128, 128, 0, 0)")
MyAction\Invoke("MakeActionGotoURL('http://www.purebasic.com')") ; Could be javascript:hello()
ActionButton\Invoke("QueueEvent(" + Str(MyAction) + "  As COMateObject, 7)") ;8 mousein, 7 mouse click
Movie\Invoke("AddObject(" + Str(ActionButton) + " As COMateObject)")


For i = 50 To 400
  Movie\Invoke("GotoFrame(" + Str(i) + ")")
  Movie\Invoke("RemoveObject(" + Str(Texto) + " As COMateObject)")
  Texto\Invoke("SetSolidFill(100, " + Str(i*2) + ", 100, 100)")
  Texto\Invoke("Rotate(" + Str(-655360 * i) + ")")
  Texto\Invoke("Scale(" + Str(655 * (i*2)) + "," + Str(655 * (i*2)) + ")")
  Movie\Invoke("AddObject(" + Str(Texto) + " As COMateObject)")
Next

Movie\Invoke("AddObject(" + Str(Texto) + " As COMateObject)") 



Movie\Invoke("WriteMovie('" + Fname + "')")

Posted: Tue Mar 03, 2009 7:01 pm
by Mistrel
Is there a similar interface for making a flash player capable of playing streaming video?

Posted: Tue Mar 03, 2009 8:45 pm
by ricardo
Mistrel wrote:Is there a similar interface for making a flash player capable of playing streaming video?
Not with this one.
You need to port MING.
http://www.libming.org

BTW, anyboy has any idea on how to do that about MING lib?

Posted: Sun Sep 06, 2009 1:19 pm
by Amundo
I hate to be a necroposter, but this is wicked ricardo, thanks for sharing!