OVH Cloud OVH Cloud

Créer des fichiers Flash en VBA sous Excel. Avancement et problèmes !

2 réponses
Avatar
Eric Schrafstetter
Bonjour,

je continue tjs mes investigations sur l'utilisation de la bibliothèque
gratuite MingX avec VBA+Excel pour créer des fichiers swf sans Flash.

Ok pour la création de forme, de clips, les actions et l'importation
d'images ou de mp3. Vous pouvez voir mes notes dans le PDF :
http://ead.univ-angers.fr/~schraf/tdas/documents/base/mingx.pdf

Mon problème concerne les fonctions :

- Cette procédure fonctionne parfaitement (elle crée une anim Flash et une
forme rectangulaire rouge de 20x50 pixels est mis sur la scène).

Sub rect()
Dim SWF As MINGXLib.Movie
Dim s As MINGXLib.Shape

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 20, 0
s.DrawLine 0, 50
s.DrawLine -20, 0
s.DrawLine 0, -50
SWF.Add s
SWF.Save "c:\ok.swf"
End Sub

- Je voudrais utiliser une fonction rectangle mais le programme suivant ne
fonctionne pas... Savez-vous où est l'erreur ?

Sub rect()
Dim SWF As MINGXLib.Movie

Set SWF = New MINGXLib.Movie
SWF.Create
SWF.SetDimension 60, 360
SWF.Add rectangle(0, 0, 20, 50, 255, 0, 0)
SWF.Save "c:\oups.swf"
End Sub

Function rectangle(x, y, l, h, r, g, b) As MINGXLib.Shape
Dim s As MINGXLib.Shape
Set s = New MINGXLib.Shape
s.Create
s.SetRightFill s.AddFill(r, g, b)
s.MovePenTo x, y
s.DrawLine l, 0
s.DrawLine 0, h
s.DrawLine -l, 0
s.DrawLine 0, -h
rectangle = s <-- NE FONCTIONNE PAS !!
End Function

Merci !

Eric S

2 réponses

Avatar
Daniel.M
Éric,

Set rectangle = s '<-- FONCTIONNE!!

Salutations,

Daniel M.
Avatar
Eric Schrafstetter
Merci Daniel ! C'était ça plus un Set s = rectangle(0, 0, 10, 10, 255, 0, 0)
directement... Super !

Éric,

Set rectangle = s '<-- FONCTIONNE!!

Salutations,

Daniel M.