je suis en train de développer un tableau blanc en flash et je coince pour
reproduire l'outil ovale comparable a celui qu'on trouve dans flash par
exemple.
dans un premier temps j'ai réutilisé le code de l'aide avec curveTo, le
problème est que en dessinant on obtient un cercle qui visuellement se
rapproche d'une patate :-)
mc_tableau.onRelease = mc_tableau.onReleaseOutside = function ()
{
clearInterval(this.tempRond_mc.intervalID);
};
J'ai trouvé des fonctions qui permettent de créer des cercles parfaits mais
du coup je ne peux plus faire d'oval
:-(
alors je recherche le moyen de dessiner dynamiquement des cercles et des
ovales, toutes les idées, pistes sont les bienvenues
var i61; var r; var mcos = Math.cos; var msin = Math.sin; while(--i>-1) { $Cosinus[i]=mcos((r=i*$rad)); $Sinus[i]=msin(r); }; delete mcos; delete msin; delete r; delete i; // Protect Constants ASSetPropFlags(_global, ["$dftSmooth","dftRay","dftPenSize","$rad","$Sinus","$Cosinus"],7); // // MovieClip.prototype.frameOval = function (x,y,w,h,th,col,alp,sm) { if (null==th) var th = $dftSize; if (null==sm) var sm = $dftSmooth; var rx,ry,cx,cy,i; i60+sm; cx = (rx=w/2)+x; cy = (ry=h/2)+y; tellTarget(this) { lineStyle(th,col,alp); moveTo((x+w),cy); while((i-=sm)>-1) { lineTo((cx+rx*$Cosinus[i]),(cy+ry*$Sinus[i])); }; lineTo((cx+rx*$Cosinus[0]),(cy+ry*$Sinus[0])); }; }; /* Parameters - x : the x coordinate of the rectangle (top left) - y : the y coordinate of the rectangle (top left) - w : the width of the rectangle - h : the height of the rectangle - th : the thickness of the line in point - col : the color - alp : the alpha value - sm : the smooth value use to draw the oval (can be used to draw some polygon, for example to draw a diamond sm = 90 (360/90 = 4)) */
/* Exemple */ _root.createEmptyMovieClip( "ovali", 1 ); ovali.frameOval(10,10,250,150,1,0x000000,100,1); stop();
/* fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code */
Romuald.
"Sébastien" a écrit dans le message news: c5lijo$ler$
Bonjour,
je suis en train de développer un tableau blanc en flash et je coince pour reproduire l'outil ovale comparable a celui qu'on trouve dans flash par exemple.
dans un premier temps j'ai réutilisé le code de l'aide avec curveTo, le problème est que en dessinant on obtient un cercle qui visuellement se rapproche d'une patate :-)
mc_tableau.onRelease = mc_tableau.onReleaseOutside = function () { clearInterval(this.tempRond_mc.intervalID); };
J'ai trouvé des fonctions qui permettent de créer des cercles parfaits
mais
du coup je ne peux plus faire d'oval :-( alors je recherche le moyen de dessiner dynamiquement des cercles et des ovales, toutes les idées, pistes sont les bienvenues
en vous remerciant -- Sébastien
Salut,
J'ai trouvé ça sur le web, cela doit pouvoir te servir (et à d'autres aussi
:)
var i61;
var r;
var mcos = Math.cos;
var msin = Math.sin;
while(--i>-1)
{
$Cosinus[i]=mcos((r=i*$rad));
$Sinus[i]=msin(r);
};
delete mcos;
delete msin;
delete r;
delete i;
// Protect Constants
ASSetPropFlags(_global,
["$dftSmooth","dftRay","dftPenSize","$rad","$Sinus","$Cosinus"],7);
//
//
MovieClip.prototype.frameOval = function (x,y,w,h,th,col,alp,sm)
{
if (null==th) var th = $dftSize;
if (null==sm) var sm = $dftSmooth;
var rx,ry,cx,cy,i;
i60+sm;
cx = (rx=w/2)+x;
cy = (ry=h/2)+y;
tellTarget(this)
{
lineStyle(th,col,alp);
moveTo((x+w),cy);
while((i-=sm)>-1)
{
lineTo((cx+rx*$Cosinus[i]),(cy+ry*$Sinus[i]));
};
lineTo((cx+rx*$Cosinus[0]),(cy+ry*$Sinus[0]));
};
};
/*
Parameters
- x : the x coordinate of the rectangle (top left)
- y : the y coordinate of the rectangle (top left)
- w : the width of the rectangle
- h : the height of the rectangle
- th : the thickness of the line in point
- col : the color
- alp : the alpha value
- sm : the smooth value use to draw the oval (can be used to draw some
polygon, for example to draw a diamond sm = 90 (360/90 = 4))
*/
/* Exemple */
_root.createEmptyMovieClip( "ovali", 1 );
ovali.frameOval(10,10,250,150,1,0x000000,100,1);
stop();
/* fin code fin code fin code fin code fin code fin code fin code
fin code fin code fin code fin code fin code */
Romuald.
"Sébastien" <a_gauche_en_sort@nt_de_lascenseur.com> a écrit dans le message
news: c5lijo$ler$1@forums.macromedia.com...
Bonjour,
je suis en train de développer un tableau blanc en flash et je coince pour
reproduire l'outil ovale comparable a celui qu'on trouve dans flash par
exemple.
dans un premier temps j'ai réutilisé le code de l'aide avec curveTo, le
problème est que en dessinant on obtient un cercle qui visuellement se
rapproche d'une patate :-)
mc_tableau.onRelease = mc_tableau.onReleaseOutside = function ()
{
clearInterval(this.tempRond_mc.intervalID);
};
J'ai trouvé des fonctions qui permettent de créer des cercles parfaits
mais
du coup je ne peux plus faire d'oval
:-(
alors je recherche le moyen de dessiner dynamiquement des cercles et des
ovales, toutes les idées, pistes sont les bienvenues
var i61; var r; var mcos = Math.cos; var msin = Math.sin; while(--i>-1) { $Cosinus[i]=mcos((r=i*$rad)); $Sinus[i]=msin(r); }; delete mcos; delete msin; delete r; delete i; // Protect Constants ASSetPropFlags(_global, ["$dftSmooth","dftRay","dftPenSize","$rad","$Sinus","$Cosinus"],7); // // MovieClip.prototype.frameOval = function (x,y,w,h,th,col,alp,sm) { if (null==th) var th = $dftSize; if (null==sm) var sm = $dftSmooth; var rx,ry,cx,cy,i; i60+sm; cx = (rx=w/2)+x; cy = (ry=h/2)+y; tellTarget(this) { lineStyle(th,col,alp); moveTo((x+w),cy); while((i-=sm)>-1) { lineTo((cx+rx*$Cosinus[i]),(cy+ry*$Sinus[i])); }; lineTo((cx+rx*$Cosinus[0]),(cy+ry*$Sinus[0])); }; }; /* Parameters - x : the x coordinate of the rectangle (top left) - y : the y coordinate of the rectangle (top left) - w : the width of the rectangle - h : the height of the rectangle - th : the thickness of the line in point - col : the color - alp : the alpha value - sm : the smooth value use to draw the oval (can be used to draw some polygon, for example to draw a diamond sm = 90 (360/90 = 4)) */
/* Exemple */ _root.createEmptyMovieClip( "ovali", 1 ); ovali.frameOval(10,10,250,150,1,0x000000,100,1); stop();
/* fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code */
Romuald.
"Sébastien" a écrit dans le message news: c5lijo$ler$
Bonjour,
je suis en train de développer un tableau blanc en flash et je coince pour reproduire l'outil ovale comparable a celui qu'on trouve dans flash par exemple.
dans un premier temps j'ai réutilisé le code de l'aide avec curveTo, le problème est que en dessinant on obtient un cercle qui visuellement se rapproche d'une patate :-)
mc_tableau.onRelease = mc_tableau.onReleaseOutside = function () { clearInterval(this.tempRond_mc.intervalID); };
J'ai trouvé des fonctions qui permettent de créer des cercles parfaits
mais
du coup je ne peux plus faire d'oval :-( alors je recherche le moyen de dessiner dynamiquement des cercles et des ovales, toutes les idées, pistes sont les bienvenues
en vous remerciant -- Sébastien
Sébastien
Salut gromu,
je viens de le mettre dans mon code, c'est pas mal du tout, ça fonctionne :-))
on peux toujours compter sur toi merci chef
PS : je reste ouvert a toutes autres propositions... -- Sébastien
"Romuald" a écrit dans le message de news: c5m9i0$nkh$
Salut,
J'ai trouvé ça sur le web, cela doit pouvoir te servir (et à d'autres
var i61; var r; var mcos = Math.cos; var msin = Math.sin; while(--i>-1) { $Cosinus[i]=mcos((r=i*$rad)); $Sinus[i]=msin(r); }; delete mcos; delete msin; delete r; delete i; // Protect Constants ASSetPropFlags(_global, ["$dftSmooth","dftRay","dftPenSize","$rad","$Sinus","$Cosinus"],7); // // MovieClip.prototype.frameOval = function (x,y,w,h,th,col,alp,sm) { if (null==th) var th = $dftSize; if (null==sm) var sm = $dftSmooth; var rx,ry,cx,cy,i; i60+sm; cx = (rx=w/2)+x; cy = (ry=h/2)+y; tellTarget(this) { lineStyle(th,col,alp); moveTo((x+w),cy); while((i-=sm)>-1) { lineTo((cx+rx*$Cosinus[i]),(cy+ry*$Sinus[i])); }; lineTo((cx+rx*$Cosinus[0]),(cy+ry*$Sinus[0])); }; }; /* Parameters - x : the x coordinate of the rectangle (top left) - y : the y coordinate of the rectangle (top left) - w : the width of the rectangle - h : the height of the rectangle - th : the thickness of the line in point - col : the color - alp : the alpha value - sm : the smooth value use to draw the oval (can be used to draw some polygon, for example to draw a diamond sm = 90 (360/90 = 4)) */
/* Exemple */ _root.createEmptyMovieClip( "ovali", 1 ); ovali.frameOval(10,10,250,150,1,0x000000,100,1); stop();
/* fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code */
Romuald.
Salut gromu,
je viens de le mettre dans mon code, c'est pas mal du tout, ça fonctionne
:-))
on peux toujours compter sur toi
merci chef
PS : je reste ouvert a toutes autres propositions...
--
Sébastien
"Romuald" <non.merci@spam.org> a écrit dans le message de news:
c5m9i0$nkh$1@forums.macromedia.com...
Salut,
J'ai trouvé ça sur le web, cela doit pouvoir te servir (et à d'autres
var i61;
var r;
var mcos = Math.cos;
var msin = Math.sin;
while(--i>-1)
{
$Cosinus[i]=mcos((r=i*$rad));
$Sinus[i]=msin(r);
};
delete mcos;
delete msin;
delete r;
delete i;
// Protect Constants
ASSetPropFlags(_global,
["$dftSmooth","dftRay","dftPenSize","$rad","$Sinus","$Cosinus"],7);
//
//
MovieClip.prototype.frameOval = function (x,y,w,h,th,col,alp,sm)
{
if (null==th) var th = $dftSize;
if (null==sm) var sm = $dftSmooth;
var rx,ry,cx,cy,i;
i60+sm;
cx = (rx=w/2)+x;
cy = (ry=h/2)+y;
tellTarget(this)
{
lineStyle(th,col,alp);
moveTo((x+w),cy);
while((i-=sm)>-1)
{
lineTo((cx+rx*$Cosinus[i]),(cy+ry*$Sinus[i]));
};
lineTo((cx+rx*$Cosinus[0]),(cy+ry*$Sinus[0]));
};
};
/*
Parameters
- x : the x coordinate of the rectangle (top left)
- y : the y coordinate of the rectangle (top left)
- w : the width of the rectangle
- h : the height of the rectangle
- th : the thickness of the line in point
- col : the color
- alp : the alpha value
- sm : the smooth value use to draw the oval (can be used to draw some
polygon, for example to draw a diamond sm = 90 (360/90 = 4))
*/
/* Exemple */
_root.createEmptyMovieClip( "ovali", 1 );
ovali.frameOval(10,10,250,150,1,0x000000,100,1);
stop();
/* fin code fin code fin code fin code fin code fin code fin code
fin code fin code fin code fin code fin code */
var i61; var r; var mcos = Math.cos; var msin = Math.sin; while(--i>-1) { $Cosinus[i]=mcos((r=i*$rad)); $Sinus[i]=msin(r); }; delete mcos; delete msin; delete r; delete i; // Protect Constants ASSetPropFlags(_global, ["$dftSmooth","dftRay","dftPenSize","$rad","$Sinus","$Cosinus"],7); // // MovieClip.prototype.frameOval = function (x,y,w,h,th,col,alp,sm) { if (null==th) var th = $dftSize; if (null==sm) var sm = $dftSmooth; var rx,ry,cx,cy,i; i60+sm; cx = (rx=w/2)+x; cy = (ry=h/2)+y; tellTarget(this) { lineStyle(th,col,alp); moveTo((x+w),cy); while((i-=sm)>-1) { lineTo((cx+rx*$Cosinus[i]),(cy+ry*$Sinus[i])); }; lineTo((cx+rx*$Cosinus[0]),(cy+ry*$Sinus[0])); }; }; /* Parameters - x : the x coordinate of the rectangle (top left) - y : the y coordinate of the rectangle (top left) - w : the width of the rectangle - h : the height of the rectangle - th : the thickness of the line in point - col : the color - alp : the alpha value - sm : the smooth value use to draw the oval (can be used to draw some polygon, for example to draw a diamond sm = 90 (360/90 = 4)) */
/* Exemple */ _root.createEmptyMovieClip( "ovali", 1 ); ovali.frameOval(10,10,250,150,1,0x000000,100,1); stop();
/* fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code fin code */