Installation

Exemples

Dessiner

Sub cercles()
Dim SWF As MINGXLib.Movie
Dim Shape As MINGXLib.Shape
Dim Action As MINGXLib.Action

Set SWF = New MINGXLib.Movie
SWF.Create
SWF.SetDimension 300, 300
SWF.SetRate 12
SWF.SetBackground 255, 255, 255
Set Shape = New MINGXLib.Shape
Shape.Create
For i = 0 To 150 Step 10
Shape.Setline 1, i, i, i
Shape.MovePenTo 150, i
Shape.DrawCircle i
Next
SWF.Add Shape
Set Action = New MINGXLib.Action
Call Action.Create("stop();")
SWF.Add Action
SWF.Save ("c:\cercles.swf")
Set SWF = Nothing
Set Shape = Nothing
Set Action = Nothing
End Sub

Dégradé

Sub grad()
Set m = New MINGXLib.Movie
m.Create
m.SetDimension 320, 240
Set s = New MINGXLib.Shape
s.Create
Set g = New MINGXLib.Gradient
g.Create
g.AddEntry 0, 0, 0, 0, 255
g.AddEntry 1, 255, 255, 255
Set f = s.AddFill_Gradient(g, 16)
f.ScaleTo 0.17, 0.17
f.MoveTo 160, 120
s.SetRightFill f
s.DrawLine 320, 0
s.DrawLine 0, 240
s.DrawLine -320, 0
s.DrawLine 0, -240
m.Add s
Set s = New MINGXLib.Shape
s.Create
Set g = New MINGXLib.Gradient
g.Create
g.AddEntry 0, 255, 0, 0, 255
g.AddEntry 1, 255, 0, 0, 0
Set f = s.AddFill_Gradient(g, 18)
f.ScaleTo 0.12, 0.12
f.MoveTo 160, 12
s.SetRightFill f
s.DrawLine 320, 0
s.DrawLine 0, 240
s.DrawLine -320, 0
s.DrawLine 0, -240
m.Add s
m.Save "c:\gradient.swf"
End Sub

Action Flash 5

Sub palette()
Dim SWF As MINGXLib.Movie
Dim s As MINGXLib.Shape
Dim c As MINGXLib.Sprite
Dim a As MINGXLib.Action
Set SWF = New MINGXLib.Movie
SWF.Create
SWF.SetDimension 60, 360
Set s = New MINGXLib.Shape
s.Create
s.SetRightFill s.AddFill(255, 0, 0)
s.MovePenTo 0, 0
s.DrawLine 10, 0
s.DrawLine 0, 10
s.DrawLine -10, 0
s.DrawLine 0, -10
Set c = New MINGXLib.Sprite
c.Create
c.Add s
c.NextFrame
Set i = SWF.Add(c)
i.SetName "carre"
Set a = New MINGXLib.Action
a.Create "c = new Array();c[0] = 255;c[1] = 204;c[2] = 153;c[3] = 102;c[4] = 51;c[5] = 0;d = 0;"
SWF.Add a
a.Create "for (i=0; i<=5; i++) {for (m=0; m<=5; m++) {for (n=0; n<=5; n++) { d++;duplicateMovieClip('carre', 'carre'+d, d);this['carre'+d]._y = 60*i+10*m;this['carre'+d]._x = 10*n;couleur = new Color(this['carre'+d]);couleur.setRGB(c[i] << 16 | c[m] << 8 | c[n]);}}}"
SWF.Add a
SWF.Save "c:\palette.swf"
End Sub

StartDrag

Sub bouton()
Dim SWF As MINGXLib.Movie
Dim b As MINGXLib.Button
Dim s As MINGXLib.Shape
Set SWF = New MINGXLib.Movie
SWF.Create
SWF.SetDimension 320, 240
Set s = New MINGXLib.Shape
s.Create
s.SetRightFill s.AddFill(255, 0, 0)
s.MovePenTo -25, -25
s.DrawLine 50, 0
s.DrawLine 0, 50
s.DrawLine -50, 0
s.DrawLine 0, -50
Set b = New MINGXLib.Button
b.Create
b.AddShape s, 15
Set Action = New MINGXLib.Action
Action.Create "startDrag(_root.test,0);"
b.AddAction Action, 4
Action.Create "stopDrag();"
b.AddAction Action, 72
Set p = New MINGXLib.Sprite
p.Create
p.Add b
p.NextFrame
Set i = SWF.Add(p)
i.SetName "test"
i.MoveTo 160, 120
SWF.Save "c:\bouton.swf"
Set SWF = Nothing
Set p = Nothing
Set s = Nothing
Set b = Nothing
Set Action = Nothing
End Sub

Images

Sub image()
Dim SWF As MINGXLib.Movie
Dim im As MINGXLib.input
Dim b As MINGXLib.Bitmap
Set SWF = New MINGXLib.Movie
SWF.Create
SWF.SetDimension 320, 240
Set im = New MINGXLib.input
im.Create ("C:\image.jpg")
Set b = New MINGXLib.Bitmap
b.Create im
SWF.Add b
SWF.Save "c:\img.swf"
Set SWF = Nothing
Set im = Nothing
Set b = Nothing
End Sub

Morphing (ici avec Excel)

Sub TestMorph()
Dim P As MINGXLib.Morph
Dim SWF As MINGXLib.Movie
Dim S1 As MINGXLib.Shape, S2 As MINGXLib.Shape
Dim i As MINGXLib.DisplayItem
Dim r As Double

Set P = CreateObject("Mingx.Morph")
P.Create

Set S1 = P.Shape1()
S1.Setline 0, 0, 0, 0
S1.SetLeftFill S1.AddFill(0, 255, 0)
S1.MovePenTo -100, -100
S1.DrawLine 200, 0
S1.DrawLine 0, 200
S1.DrawLine -200, 0
S1.DrawLine 0, -200

Set S2 = P.Shape2()
S2.Setline 15, 0, 0, 0
S2.SetLeftFill S2.AddFill(150, 1, 1)
S2.MovePenTo 0, -50
S2.DrawLine 50, 50
S2.DrawLine -50, 50
S2.DrawLine -50, -50
S2.DrawLine 50, -50

Set SWF = CreateObject("Mingx.Movie")
SWF.Create
SWF.SetDimension 300, 200
SWF.SetBackground 150, 1, 1
Set i = SWF.Add(P)
i.MoveTo 150, 100

For r = 0 To 1 Step 0.02
i.SetRatio (r)
SWF.NextFrame
Next
SWF.Save (ThisWorkbook.Path & "\TestMorph.swf")
End Sub

Souris

Sub souris()
Dim SWF As MINGXLib.Movie
Dim Action1 As MINGXLib.Action, Action2 As MINGXLib.Action, Action3 As MINGXLib.Action
Dim Action4 As MINGXLib.Action, Action5 As MINGXLib.Action, Action6 As MINGXLib.Action
Dim Action7 As MINGXLib.Action
Dim G As MINGXLib.Gradient
Dim S As MINGXLib.Shape
Dim F As MINGXLib.Fill
Dim P1 As MINGXLib.Sprite, Q As MINGXLib.Sprite, P2 As MINGXLib.Sprite
Dim i As MINGXLib.DisplayItem

Set SWF = CreateObject("Mingx.Movie")
SWF.Create
SWF.SetDimension 320, 240
SWF.SetBackground 0, 0, 250

Set Action1 = CreateObject("Mingx.Action")
Action1.Create ("_quality = 'LOW';frames._visible = false;sparks = [];")
SWF.Add Action1

Set G = CreateObject("Mingx.Gradient")
G.Create
G.AddEntry 0, 0, 0, 0, 0
G.AddEntry 0.1, 0, 0, 0, 0
G.AddEntry 0.5, 0, 0, 0, 120
G.AddEntry 1, 0, 0, 0, 0

Set S = CreateObject("Mingx.Shape")
S.Create
Set F = S.AddFill_Gradient(G, 175)
F.ScaleTo 0.03, 0.03

S.SetRightFill F
S.MovePenTo -30, -30
S.DrawLine 60, 0
S.DrawLine 0, 60
S.DrawLine -60, 0
S.DrawLine 0, -60

Set P1 = CreateObject("Mingx.Sprite")
P1.Create
Set i = P1.Add(S)
P1.NextFrame

Set Q = CreateObject("Mingx.Sprite")
Q.Create
Set Action2 = CreateObject("Mingx.Action")
Action2.Create ("gotoFrame(random(7)+1); stop();")
Set i = Q.Add(Action2)

Set i = Q.Add(P1)
i.MultColor 1, 1, 1
Q.NextFrame
i.MultColor 1, 0.5, 0.5
Q.NextFrame
i.MultColor 1, 0.75, 0.5
Q.NextFrame
i.MultColor 1, 1, 0.5
Q.NextFrame
i.MultColor 0.5, 1, 0.5
Q.NextFrame
i.MultColor 0.5, 0.5, 1
Q.NextFrame
i.MultColor 1, 0.5, 1
Q.NextFrame

Set P2 = CreateObject("Mingx.Sprite")
P2.Create
Set i = P2.Add(Q)
i.SetName ("frames")

Set Action3 = CreateObject("Mingx.Action")
Action3.Create ("dx = _root.dx/3 + random(10)-5;dy = _root.dy/3;x = _root._xmouse;y = _root._ymouse;alpha =100;")
Set i = P2.Add(Action3)
P2.NextFrame

Set Action4 = CreateObject("Mingx.Action")
Action4.Create ("this._x = x;this._y = y;this._alpha = alpha;x += dx;y += dy;dy += 3;alpha -= 8;")
Set i = P2.Add(Action4)
P2.NextFrame

Set Action5 = CreateObject("Mingx.Action")
Action5.Create ("prevFrame(); play();")
Set i = P2.Add(Action5)
P2.NextFrame

Set i = SWF.Add(P2)
i.SetName ("frames")
SWF.NextFrame

Set Action6 = CreateObject("Mingx.Action")
Action6.Create ("dx = _xmouse - lastx;dy = _ymouse - lasty;lastx = _xmouse;lasty = _ymouse;if(++num == 11)num = 1;if(sparks[num]) removeMovieClip(sparks[num]);duplicateMovieClip('frames', 'char'+num,num);sparks[num] = this['char'+num];")
Set i = SWF.Add(Action6)
SWF.NextFrame

Set Action7 = CreateObject("Mingx.Action")
Action7.Create ("prevFrame(); play();")
Set i = SWF.Add(Action7)

SWF.Save (ThisWorkbook.Path & "\souris.swf")
End Sub

 

Installation