Comunidad de diseño web y desarrollo en internet online

Cargar imagen a flash, vinculada desde xml

Citar            
MensajeEscrito el 04 Oct 2005 02:05 pm
Hola a todos.
Quisiera saber como hacerle para cargar dentro de mi archivo flash una imagen definida desde un xml, solo necesito el código para generar ese vinculo, pues necesito que quede dinamico todo esto. con el objetivo de subir cualquier imagen al xml y por ende ver los cambios en el flash sin necesidad de volver a manipularlo.... Gracias a todos espero sus ayudas!!! ^^

Por oscarcangel

51 de clabLevel



 

2004

msie
Citar            
MensajeEscrito el 04 Oct 2005 02:47 pm
esto es un XML de ejemplo

Código :

<datos>
<dato id="1" palabra="Monitor" imagen="monitor.jpg" />
<dato id="2" palabra="Mouse" imagen="mouse.jpg" />
</datos>


en Flash :

Código :

var mxml:XML = new XML();
mxml.ignoreWhite = true;

mxml.onLoad = function(cargo){
 if (cargo){
    //Aqui empiezas a sacar las rutas de imagenes del XML
   mc.loadMovie (mxml.firstChild.childNodes[0].attributes.imagen);
   //Aqui solamente carga el primer elemento del XML! :-)
   //mc es un clip de pelicula..
 } else {
   //Se cargo mal el XML
 }
}

mxml.load("fichero.xml"); //Cargo el XML 



saludos ^^

Por Zandy

Claber

1345 de clabLevel

5 tutoriales

Genero:Masculino   Premio_Secretos

firefox
Citar            
MensajeEscrito el 04 Oct 2005 02:49 pm
esto es un XML de ejemplo

Código :

<datos>
<dato id="1" palabra="Monitor" imagen="monitor.jpg" />
<dato id="2" palabra="Mouse" imagen="mouse.jpg" />
</datos>


en Flash :

Código :

var mxml:XML = new XML();
mxml.ignoreWhite = true;

mxml.onLoad = function(cargo){
 if (cargo){
    //Aqui empiezas a sacar las rutas de imagenes del XML
   mc.loadMovie (mxml.firstChild.childNodes[0].attributes.imagen);
   //Aqui solamente carga el primer elemento del XML! :-)
   //mc es un clip de pelicula..
 } else {
   //Se cargo mal el XML
 }
}

mxml.load("fichero.xml"); //Cargo el XML 



saludos ^^

Por Zandy

Claber

1345 de clabLevel

5 tutoriales

Genero:Masculino   Premio_Secretos

firefox
Citar            
MensajeEscrito el 04 Oct 2005 03:57 pm
mmmmmmmmm...hay algo que no me funciona...no se que es...:S...aun asi Super Gracias....me haz puesto a echar codigo....

Por oscarcangel

51 de clabLevel



 

2004

msie
Citar            
MensajeEscrito el 04 Oct 2005 05:34 pm
que error sale o que sale

lo probe antes de postear y funciona , estas seguro que el XML esta en el mismo directorio del swf o te haz fijado si existen las imagenes que estan en el XML, tienen que estar en la el mismo dir del swf !

saludos

Por Zandy

Claber

1345 de clabLevel

5 tutoriales

Genero:Masculino   Premio_Secretos

firefox
Citar            
MensajeEscrito el 04 Oct 2005 07:08 pm
es extraño...porque el flash hace el debug, mostrandome las variables que esta leyendo,y efectivamante son las del xml....

Nivel #0:
Variable _level0.$version = "WIN 8,0,22,0"
Variable _level0.mxml = [objeto #1] {

<datos>
<dato id="1" palabra="Monitor" imagen="ima1.jpg" />
<dato id="2" palabra="Mouse" imagen="images/02.jpg" />
</datos>
}

...pero no logro ver en el flash mi imagen: ima1.jpg.´
...ni tampoco otra que inclui en una carpeta "images" 02.jpg
:S...bien raro

Por oscarcangel

51 de clabLevel



 

2004

msie
Citar            
MensajeEscrito el 04 Oct 2005 08:26 pm
uhmmm,,,

bueno, voy a postearte un link con los ejemplo,solo dame unos minutos,

de todas maneras postea el codigo del .fla para hecharle un vistazo.


saludos

Por Zandy

Claber

1345 de clabLevel

5 tutoriales

Genero:Masculino   Premio_Secretos

firefox
Citar            
MensajeEscrito el 04 Oct 2005 08:39 pm
Mira aqui te va el ejemplo, descomprimelo y pruebalo. :-)

http://preloa.webcindario.com/ejemplo.rar

saludos

Por Zandy

Claber

1345 de clabLevel

5 tutoriales

Genero:Masculino   Premio_Secretos

firefox
Citar            
MensajeEscrito el 15 Sep 2008 08:54 am
Hola! estoy interesado en el tema de este post, pero... cuando he ido a descargar el ejemplo ya no estaba....aunque no me extraña ya que la ultima respuesta fecha de 2005 xD. Basicamente estoy interessado en crear una galeria de imagenes actualizable desde xml pero royo simple ya que no domino mucho el codigo que digamos :P. Ahora voy a provar los codigos que mencionais y os comento si me funciona. Muchas Gracias! dwww

Por LMK

6 de clabLevel



 

firefox
Citar            
MensajeEscrito el 10 Ago 2009 06:33 pm
ammm si te muetra un debug creo que podria solucionarse asi:

Código XML :

<?xml version="1.0" encoding="iso-8859-1"?>
<fichero>
<imagen id="img01.jpg"/>
<imagen id="img02.jpg"/>
<imagen id="img03.jpg"/>
<imagen id="img04.jpg"/>
<imagen id="img05.jpg"/>
<imagen id="img06.jpg"/>
<imagen id="img07.jpg"/>
<imagen id="img08.jpg"/>
<imagen id="img09.jpg"/>
</fichero>


Código ActionScript :

var mxml:XML = new XML();
mxml.ignoreWhite = true;

mxml.onLoad = function(cargo){
 if (cargo){
    //Aqui empiezas a sacar las rutas de imagenes del XML
   mc.loadMovie (mxml.firstChild.childNodes[0].attributes.imagen);
   //Aqui solamente carga el primer elemento del XML! :-)
   //mc es un clip de pelicula..
 } else {
   //Se cargo mal el XML
 }
}
miXML.load("fichero.xml"); //Cargo el XML 

Saludos!

Por dante00

3 de clabLevel



 

msie7
Citar            
MensajeEscrito el 21 Sep 2009 09:32 pm
Hola a todos, interesante tema necesito que me ayuden; descargue un calendario el cual emplea estos codigos que adjunto; he conseguido modificar la interfaz original y le di un aspecto mas personal; pero mi problema viene dado porque quiero cargar una imagen desde el archivo xml (q tambn trae) en un popup que es llamado desde la biblioteca por un boton al ser presionado, este popup me muestra informacion textual q uno le coloca en el archivo xml; pero quiero una forma de insertar tambien en ese popup una imagen desde ese mismo archivo. yo coloque dentro del popup un movieclip vacio con el nombre pic el cual queria reemplazar por la imagen pero por mas que intento no lo consigo; si pueden ayudarme se los agradeceria mucho.

Este codigo se encuentra en un fotograma del popup

Código ActionScript :

_root.forwd_btn.enabled=false;
_root.back_btn.enabled=false;
mydate_txt.textColor=_root.myColorAS;
//CSS
trace(_root.myColor);
var styles = new TextField.StyleSheet();
styles.setStyle("a:link", 
  {color: _root.myColorHTML,textDecoration: 'underline'} 
);
styles.setStyle("a:hover", 
  {color: _root.myColorHTML,textDecoration: 'none'}
);
popup_txt.styleSheet = styles;
stop();
for (var i=1;i<=31;i++){
   var mc="square" + i;
   _root[mc].square_mc.square_btn.enabled=false;
}



Este codigo es el que se encuentra en el boton

[as]on (release) {
var month_path="namemonth" + _root.mymonth;
_root.print_btn.enabled=false;
_root.attachMovie("popup","popup1",100);
_root.popup1._x=2.5;
_root.popup1._y=2.5;
_root.popup1.mydate=this._parent.daynum+" "+ _root[month_path] + ", " + _root.myyear;

if(this._parent.description==undefined){
_root.popup1.description="";
}else{
_root.popup1.description=this._parent.description;//description stored in corresponding square (day)
}
}
[as]




Estos son los codigos de la animacion.

Fotograma 1
[as]//XML file
//---------------------------------------------------
//LOCATION: assets/calendar.xml
//SOURCE:
//<calendar color="0x552233">
// <year value="2004">
// <month value="3">
// <day value="10">
// <image>this appears on the calendar day</image>
// <label>this appears on the calendar day</label>
// <description>this appears in the popup</description>
// </day>
// </month>
// </year>
//</calendar>
// day values must be in ascending order
// EX: <day value="3"></day>
// <day value="7"></day>
// <day value="10"></day>

//*test if days/months/years will work when not in ascending order


// initialize date
today_date = new Date();
todayMonth=today_date.getMonth() + 1
todayDay=today_date.getDate();
todayYear=today_date.getFullYear();

mymonth=todayMonth;
trace("month: " + mymonth);
myday=todayDay;
trace("day: " + myday);
myyear=todayYear;
trace("year: " + myyear);

//load xml file
calendar_xml = new XML();
calendar_xml.ignoreWhite=true;
calendar_xml.load("calendar.xml")
calendar_xml.onLoad = xml_handler;

var yearNode_xml;
var monthNode_xml;
var dayNode_xml;

// executes when xml file has loaded (used as MAIN function)
function xml_handler(success)
{
if (success==true){
trace ("...xml file loaded");
//set color
//_root.myColor="0x556677";
_root.myColorHTML="#"+calendar_xml.firstChild.attributes.color;
_root.myColorAS="0x"+calendar_xml.firstChild.attributes.color;
//find today's year
yearNode_xml=findYear(myyear);
//find today's month
monthNode_xml=findMonth(yearNode_xml,mymonth);

gotoAndPlay(2);
}

else{
trace("...error loading xml file");
break;
}
}

function findYear(year_num)
{
var yearNode_xml=calendar_xml.firstChild.firstChild;

while (yearNode_xml.attributes.value!=year_num)
{
yearNode_xml=yearNode_xml.nextSibling;
if (yearNode_xml == null)
{
trace ("...no xml enteries within that year");
return 0;// error flag
}
}

trace("yearXML: " + yearNode_xml.attributes.value);
return yearNode_xml;
}

function findMonth(yearNode_xml,month_num)
{
var monthNode_xml=yearNode_xml.firstChild;

while (monthNode_xml.attributes.value!=month_num)
{
monthNode_xml=monthNode_xml.nextSibling;
if (monthNode_xml == null)
{
trace ("...no xml enteries within that month");
return 0;// error flag
}
}

trace("monthXML: " + monthNode_xml.attributes.value);
return monthNode_xml;
}

function findDay(monthNode_xml,day_num)
{
var dayNode_xml=monthNode_xml.firstChild;

while (dayNode_xml.attributes.value!=day_num)
{
dayNode_xml=dayNode_xml.nextSibling;
if (dayNode_xml == null)
{
trace ("...no xml enteries for that day");
return 0;// error flag
}
}

trace("monthXML: " + monthNode_xml.attributes.value);
return dayNode_xml;
}

function setDay(dayNode_xml,day_num,mc){
trace("day: " + day_num);
trace("dayXML: " + dayNode_xml.attributes.value);



if (dayNode_xml.attributes.value==day_num){
//-----------------------------------------------
var itemsNode_xml=dayNode_xml.firstChild;

//initialize items array
itemsNodes_xml=[];
total = dayNode_xml.childNodes.length;
//empty text boxes and initialize content
_root[mc].description="";

//loop through the items array
for(i=0;i<total;i++){
itemsNodes_xml[i]=dayNode_xml.childNodes[i];
}
trace("yes entry for this day");

while (itemsNode_xml!=null){
//reference items in items array
for(p=0;p<total;p++){
if (itemsNodes_xml[p].nodeName=="label")
{
trace("yes label: " + itemsNode_xml.nodeValue);
_root[mc].label +=itemsNodes_xml[p].firstChild.nodeValue+"\n";

}
else if (itemsNodes_xml[p].nodeName=="image" && itemsNodes_xml[p].firstChild.nodeValue!=undefined)
{
trace("yes Image");
_root[mc].square_mc.pic.loadMovie(itemsNodes_xml[p].firstChild.nodeValue);
_root[mc].label +="\n\n";
}
else if (itemsNodes_xml[p].nodeName=="description")
{
trace("yes description: " + itemsNode_xml.nodeValue);
_root
_root[mc].description +=itemsNodes_xml[p].firstChild.nodeValue+"\n\n";
}
else{
trace("error");
}

itemsNode_xml=itemsNode_xml.nextSibling;
}
}


//-----------------------------------------
dayNode_xml=dayNode_xml.nextSibling;


if (dayNode_xml == null)
{
trace ("...no more xml day enteries");
return 0;// error flag
}

}

else{
trace("no entry for this day");
}

return dayNode_xml;
}

//*** testing functions ***
//-------------------------------------------------------------------
function printGroup (groupNode_xml){
trace ("<" + groupNode_xml.nodeName + " value=" + groupNode_xml.attributes.value1 + ">");
}

//-------------------------------------------------------------------
function printItem (itemNode_xml){
trace(" <" + itemNode_xml.nodeName + " URL=" + itemNode_xml.attributes.URL + ">");
trace(" -"+itemNode_xml.firstChild.nodeValue);
}

//-------------------------------------------------------------------
function printSubgroup(subgroupNode_xml){
trace(" <" + subgroupNode_xml.nodeName + " title=" + subgroupNode_xml.attributes.title+">");
}

function printSubitem(subitemNode_xml){
trace(" <" + subitemNode_xml.nodeName + " URL=" + subitemNode_xml.attributes.URL + ">");
trace(" -"+subitemNode_xml.firstChild.nodeValue);
}

stop();[/as]

Fotograma 2
[as]// set up days in month
_root.today="Hoy: " + _root.todayDay + " / " + _root.todayMonth + " / " + _root.todayYear;
_root.dom_txt.textColor=_root.myColorAS;
_root.lun_txt.textColor=_root.myColorAS;
_root.mar_txt.textColor=_root.myColorAS;
_root.mie_txt.textColor=_root.myColorAS;
_root.jue_txt.textColor=_root.myColorAS;
_root.vie_txt.textColor=_root.myColorAS;
_root.sab_txt.textColor=_root.myColorAS;
_root.hoy_txt.textColor=_root.myColorAS;
back_btnColor=new Color(_root.btn_bkgrd_mc1);
back_btnColor.setRGB(_root.myColorAS);
forw_btnColor=new Color(_root.btn_bkgrd_mc2);
forw_btnColor.setRGB(_root.myColorAS);

month1 = 31;
month2 = 28;
month3 = 31;
month4 = 30;
month5 = 31;
month6 = 30;
month7 = 31;
month8 = 31;
month9 = 30;
month10 = 31;
month11 = 30;
month12 = 31;

// set up month names
namemonth1 = "Enero";
namemonth2 = "Febrero";
namemonth3 = "Marzo";
namemonth4 = "Abril";
namemonth5 = "Mayo";
namemonth6 = "Junio";
namemonth7 = "Julio";
namemonth8 = "Agosto";
namemonth9 = "Septiembre";
namemonth10 = "Octubre";
namemonth11 = "Noviembre";
namemonth12 = "Diciembre";[/as]



Fotograma 3
[as]// which day of week does the month begin on
juliandate = Number(Number(Number(367*myyear-int(7*(Number(myyear)+Number(int((Number(mymonth)+9)/12)))/4))+Number(int((275*mymonth)/9)))+1)+1721013.5;
mjd = juliandate-2400000.5;
whichday = mjd-int(mjd/7)*7;
whichday = Number(whichday)+3;
if (Number(whichday)>=7) {
whichday = whichday-7;
}
// initialize day and row variables
counter = 2;
currentday = Number(whichday)+1;
currentrow = 0;
daysinmonth = eval("month" add mymonth);
// check for leap year
if (Number(int(myyear/4)) == Number((myyear/4)) and Number(mymonth) == 2) {
daysinmonth = 29;
}
//initialize day1
if(_root.yearNode_xml==0 || _root.monthNode_xml==0){
_root.dayNode_xml=0;
}
else{
_root.dayNode_xml=monthNode_xml.firstChild;
_root.dayNode_xml=setDay(_root.dayNode_xml,1,"square1");
}
//set day1 values
while (Number(counter)<=Number(daysinmonth)) {
// end of week? start new row
if (Number(currentday) == 7) {
currentday = 0;
currentrow = Number(currentrow)+1;
}
// duplicate square for each day in month and move to correct position and intialize values
duplicateMovieClip("/square1", "square" add counter, counter);
setProperty("/square" add counter, _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*currentday));
setProperty("/square" add counter, _y, Number(getProperty("/square1", _y))+Number(getProperty("/square1", _height)*currentrow));
set("/square" add counter add ":daynum", counter);
_root.dayNode_xml=setDay(_root.dayNode_xml,counter,"square"+counter);
counter = Number(counter)+1;
currentday = Number(currentday)+1;
}
// move first day into right spot
setProperty("/square1", _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*whichday));
// highlight current day
if((_root.myyear==_root.todayYear)&&(_root.mymonth==_root.todayMonth)){
var mc="square"+myday;
_root[mc].daynum_txt.textColor=0x0066ff;
}
// month title
monthtitle = eval("namemonth" add mymonth) add " " add myyear;
trace("MONTHTITLE: " + monthtitle);
_root.monthtitle_txt.text=monthtitle;
_root.monthtitle_txt.textColor=_root.myColorAS;
[/as]

Fotograma 4 tiene solo un [as]stop();[/as]


Por favor muchachos, no posteo con frecuencia o me atreveria a decir que nunca lo he hecho, pero 100pre ando revisando los tutos de aca que son muy buenos y esta vez necesito urgentemente su ayuda.... gracias :cry:

Por jakiras

Claber

148 de clabLevel



Genero:Femenino  

msie8
Citar            
MensajeEscrito el 21 Sep 2009 09:34 pm
Hola a todos, interesante tema necesito que me ayuden; descargue un calendario el cual emplea estos codigos que adjunto; he conseguido modificar la interfaz original y le di un aspecto mas personal; pero mi problema viene dado porque quiero cargar una imagen desde el archivo xml (q tambn trae) en un popup que es llamado desde la biblioteca por un boton al ser presionado, este popup me muestra informacion textual q uno le coloca en el archivo xml; pero quiero una forma de insertar tambien en ese popup una imagen desde ese mismo archivo. yo coloque dentro del popup un movieclip vacio con el nombre pic el cual queria reemplazar por la imagen pero por mas que intento no lo consigo; si pueden ayudarme se los agradeceria mucho.

Este codigo se encuentra en un fotograma del popup

Código ActionScript :

_root.forwd_btn.enabled=false;
_root.back_btn.enabled=false;
mydate_txt.textColor=_root.myColorAS;
//CSS
trace(_root.myColor);
var styles = new TextField.StyleSheet();
styles.setStyle("a:link", 
  {color: _root.myColorHTML,textDecoration: 'underline'} 
);
styles.setStyle("a:hover", 
  {color: _root.myColorHTML,textDecoration: 'none'}
);
popup_txt.styleSheet = styles;
stop();
for (var i=1;i<=31;i++){
   var mc="square" + i;
   _root[mc].square_mc.square_btn.enabled=false;
}



Este codigo es el que se encuentra en el boton

[as]on (release) {
var month_path="namemonth" + _root.mymonth;
_root.print_btn.enabled=false;
_root.attachMovie("popup","popup1",100);
_root.popup1._x=2.5;
_root.popup1._y=2.5;
_root.popup1.mydate=this._parent.daynum+" "+ _root[month_path] + ", " + _root.myyear;

if(this._parent.description==undefined){
_root.popup1.description="";
}else{
_root.popup1.description=this._parent.description;//description stored in corresponding square (day)
}
}
[as]




Estos son los codigos de la animacion.

Fotograma 1
[as]//XML file
//---------------------------------------------------
//LOCATION: assets/calendar.xml
//SOURCE:
//<calendar color="0x552233">
// <year value="2004">
// <month value="3">
// <day value="10">
// <image>this appears on the calendar day</image>
// <label>this appears on the calendar day</label>
// <description>this appears in the popup</description>
// </day>
// </month>
// </year>
//</calendar>
// day values must be in ascending order
// EX: <day value="3"></day>
// <day value="7"></day>
// <day value="10"></day>

//*test if days/months/years will work when not in ascending order


// initialize date
today_date = new Date();
todayMonth=today_date.getMonth() + 1
todayDay=today_date.getDate();
todayYear=today_date.getFullYear();

mymonth=todayMonth;
trace("month: " + mymonth);
myday=todayDay;
trace("day: " + myday);
myyear=todayYear;
trace("year: " + myyear);

//load xml file
calendar_xml = new XML();
calendar_xml.ignoreWhite=true;
calendar_xml.load("calendar.xml")
calendar_xml.onLoad = xml_handler;

var yearNode_xml;
var monthNode_xml;
var dayNode_xml;

// executes when xml file has loaded (used as MAIN function)
function xml_handler(success)
{
if (success==true){
trace ("...xml file loaded");
//set color
//_root.myColor="0x556677";
_root.myColorHTML="#"+calendar_xml.firstChild.attributes.color;
_root.myColorAS="0x"+calendar_xml.firstChild.attributes.color;
//find today's year
yearNode_xml=findYear(myyear);
//find today's month
monthNode_xml=findMonth(yearNode_xml,mymonth);

gotoAndPlay(2);
}

else{
trace("...error loading xml file");
break;
}
}

function findYear(year_num)
{
var yearNode_xml=calendar_xml.firstChild.firstChild;

while (yearNode_xml.attributes.value!=year_num)
{
yearNode_xml=yearNode_xml.nextSibling;
if (yearNode_xml == null)
{
trace ("...no xml enteries within that year");
return 0;// error flag
}
}

trace("yearXML: " + yearNode_xml.attributes.value);
return yearNode_xml;
}

function findMonth(yearNode_xml,month_num)
{
var monthNode_xml=yearNode_xml.firstChild;

while (monthNode_xml.attributes.value!=month_num)
{
monthNode_xml=monthNode_xml.nextSibling;
if (monthNode_xml == null)
{
trace ("...no xml enteries within that month");
return 0;// error flag
}
}

trace("monthXML: " + monthNode_xml.attributes.value);
return monthNode_xml;
}

function findDay(monthNode_xml,day_num)
{
var dayNode_xml=monthNode_xml.firstChild;

while (dayNode_xml.attributes.value!=day_num)
{
dayNode_xml=dayNode_xml.nextSibling;
if (dayNode_xml == null)
{
trace ("...no xml enteries for that day");
return 0;// error flag
}
}

trace("monthXML: " + monthNode_xml.attributes.value);
return dayNode_xml;
}

function setDay(dayNode_xml,day_num,mc){
trace("day: " + day_num);
trace("dayXML: " + dayNode_xml.attributes.value);



if (dayNode_xml.attributes.value==day_num){
//-----------------------------------------------
var itemsNode_xml=dayNode_xml.firstChild;

//initialize items array
itemsNodes_xml=[];
total = dayNode_xml.childNodes.length;
//empty text boxes and initialize content
_root[mc].description="";

//loop through the items array
for(i=0;i<total;i++){
itemsNodes_xml[i]=dayNode_xml.childNodes[i];
}
trace("yes entry for this day");

while (itemsNode_xml!=null){
//reference items in items array
for(p=0;p<total;p++){
if (itemsNodes_xml[p].nodeName=="label")
{
trace("yes label: " + itemsNode_xml.nodeValue);
_root[mc].label +=itemsNodes_xml[p].firstChild.nodeValue+"\n";

}
else if (itemsNodes_xml[p].nodeName=="image" && itemsNodes_xml[p].firstChild.nodeValue!=undefined)
{
trace("yes Image");
_root[mc].square_mc.pic.loadMovie(itemsNodes_xml[p].firstChild.nodeValue);
_root[mc].label +="\n\n";
}
else if (itemsNodes_xml[p].nodeName=="description")
{
trace("yes description: " + itemsNode_xml.nodeValue);
_root
_root[mc].description +=itemsNodes_xml[p].firstChild.nodeValue+"\n\n";
}
else{
trace("error");
}

itemsNode_xml=itemsNode_xml.nextSibling;
}
}


//-----------------------------------------
dayNode_xml=dayNode_xml.nextSibling;


if (dayNode_xml == null)
{
trace ("...no more xml day enteries");
return 0;// error flag
}

}

else{
trace("no entry for this day");
}

return dayNode_xml;
}

//*** testing functions ***
//-------------------------------------------------------------------
function printGroup (groupNode_xml){
trace ("<" + groupNode_xml.nodeName + " value=" + groupNode_xml.attributes.value1 + ">");
}

//-------------------------------------------------------------------
function printItem (itemNode_xml){
trace(" <" + itemNode_xml.nodeName + " URL=" + itemNode_xml.attributes.URL + ">");
trace(" -"+itemNode_xml.firstChild.nodeValue);
}

//-------------------------------------------------------------------
function printSubgroup(subgroupNode_xml){
trace(" <" + subgroupNode_xml.nodeName + " title=" + subgroupNode_xml.attributes.title+">");
}

function printSubitem(subitemNode_xml){
trace(" <" + subitemNode_xml.nodeName + " URL=" + subitemNode_xml.attributes.URL + ">");
trace(" -"+subitemNode_xml.firstChild.nodeValue);
}

stop();[/as]

Fotograma 2
[as]// set up days in month
_root.today="Hoy: " + _root.todayDay + " / " + _root.todayMonth + " / " + _root.todayYear;
_root.dom_txt.textColor=_root.myColorAS;
_root.lun_txt.textColor=_root.myColorAS;
_root.mar_txt.textColor=_root.myColorAS;
_root.mie_txt.textColor=_root.myColorAS;
_root.jue_txt.textColor=_root.myColorAS;
_root.vie_txt.textColor=_root.myColorAS;
_root.sab_txt.textColor=_root.myColorAS;
_root.hoy_txt.textColor=_root.myColorAS;
back_btnColor=new Color(_root.btn_bkgrd_mc1);
back_btnColor.setRGB(_root.myColorAS);
forw_btnColor=new Color(_root.btn_bkgrd_mc2);
forw_btnColor.setRGB(_root.myColorAS);

month1 = 31;
month2 = 28;
month3 = 31;
month4 = 30;
month5 = 31;
month6 = 30;
month7 = 31;
month8 = 31;
month9 = 30;
month10 = 31;
month11 = 30;
month12 = 31;

// set up month names
namemonth1 = "Enero";
namemonth2 = "Febrero";
namemonth3 = "Marzo";
namemonth4 = "Abril";
namemonth5 = "Mayo";
namemonth6 = "Junio";
namemonth7 = "Julio";
namemonth8 = "Agosto";
namemonth9 = "Septiembre";
namemonth10 = "Octubre";
namemonth11 = "Noviembre";
namemonth12 = "Diciembre";[/as]

Fotograma 3
[as]// which day of week does the month begin on
juliandate = Number(Number(Number(367*myyear-int(7*(Number(myyear)+Number(int((Number(mymonth)+9)/12)))/4))+Number(int((275*mymonth)/9)))+1)+1721013.5;
mjd = juliandate-2400000.5;
whichday = mjd-int(mjd/7)*7;
whichday = Number(whichday)+3;
if (Number(whichday)>=7) {
whichday = whichday-7;
}
// initialize day and row variables
counter = 2;
currentday = Number(whichday)+1;
currentrow = 0;
daysinmonth = eval("month" add mymonth);
// check for leap year
if (Number(int(myyear/4)) == Number((myyear/4)) and Number(mymonth) == 2) {
daysinmonth = 29;
}
//initialize day1
if(_root.yearNode_xml==0 || _root.monthNode_xml==0){
_root.dayNode_xml=0;
}

else{
_root.dayNode_xml=monthNode_xml.firstChild;
_root.dayNode_xml=setDay(_root.dayNode_xml,1,"square1");
}

//set day1 values


while (Number(counter)<=Number(daysinmonth)) {
// end of week? start new row
if (Number(currentday) == 7) {
currentday = 0;
currentrow = Number(currentrow)+1;
}
// duplicate square for each day in month and move to correct position and intialize values
duplicateMovieClip("/square1", "square" add counter, counter);
setProperty("/square" add counter, _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*currentday));
setProperty("/square" add counter, _y, Number(getProperty("/square1", _y))+Number(getProperty("/square1", _height)*currentrow));
set("/square" add counter add ":daynum", counter);

_root.dayNode_xml=setDay(_root.dayNode_xml,counter,"square"+counter);

counter = Number(counter)+1;
currentday = Number(currentday)+1;
}
// move first day into right spot
setProperty("/square1", _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*whichday));


// highlight current day
if((_root.myyear==_root.todayYear)&&(_root.mymonth==_root.todayMonth)){
var mc="square"+myday;
_root[mc].daynum_txt.textColor=0x0066ff;
}

// month title
monthtitle = eval("namemonth" add mymonth) add " " add myyear;
trace("MONTHTITLE: " + monthtitle);
_root.monthtitle_txt.text=monthtitle;
_root.monthtitle_txt.textColor=_root.myColorAS;
[/as]

Fotograma 4 tiene solo un [as]stop();[/as]


Por favor muchachos, no posteo con frecuencia o me atreveria a decir que nunca lo he hecho, pero 100pre ando revisando los tutos de aca que son muy buenos y esta vez necesito urgentemente su ayuda.... gracias :-)

Por jakiras

Claber

148 de clabLevel



Genero:Femenino  

msie8
Citar            
MensajeEscrito el 21 Sep 2009 09:35 pm
Hola a todos, interesante tema necesito que me ayuden; descargue un calendario el cual emplea estos codigos que adjunto; he conseguido modificar la interfaz original y le di un aspecto mas personal; pero mi problema viene dado porque quiero cargar una imagen desde el archivo xml (q tambn trae) en un popup que es llamado desde la biblioteca por un boton al ser presionado, este popup me muestra informacion textual q uno le coloca en el archivo xml; pero quiero una forma de insertar tambien en ese popup una imagen desde ese mismo archivo. yo coloque dentro del popup un movieclip vacio con el nombre pic el cual queria reemplazar por la imagen pero por mas que intento no lo consigo; si pueden ayudarme se los agradeceria mucho.

Este codigo se encuentra en un fotograma del popup

Código ActionScript :

_root.forwd_btn.enabled=false;
_root.back_btn.enabled=false;
mydate_txt.textColor=_root.myColorAS;
//CSS
trace(_root.myColor);
var styles = new TextField.StyleSheet();
styles.setStyle("a:link", 
  {color: _root.myColorHTML,textDecoration: 'underline'} 
);
styles.setStyle("a:hover", 
  {color: _root.myColorHTML,textDecoration: 'none'}
);
popup_txt.styleSheet = styles;
stop();
for (var i=1;i<=31;i++){
   var mc="square" + i;
   _root[mc].square_mc.square_btn.enabled=false;
}



Este codigo es el que se encuentra en el boton

[as]on (release) {
var month_path="namemonth" + _root.mymonth;
_root.print_btn.enabled=false;
_root.attachMovie("popup","popup1",100);
_root.popup1._x=2.5;
_root.popup1._y=2.5;
_root.popup1.mydate=this._parent.daynum+" "+ _root[month_path] + ", " + _root.myyear;

if(this._parent.description==undefined){
_root.popup1.description="";
}else{
_root.popup1.description=this._parent.description;//description stored in corresponding square (day)
}
}
[as]




Estos son los codigos de la animacion.

Fotograma 1
[as]//XML file
//---------------------------------------------------
//LOCATION: assets/calendar.xml
//SOURCE:
//<calendar color="0x552233">
// <year value="2004">
// <month value="3">
// <day value="10">
// <image>this appears on the calendar day</image>
// <label>this appears on the calendar day</label>
// <description>this appears in the popup</description>
// </day>
// </month>
// </year>
//</calendar>
// day values must be in ascending order
// EX: <day value="3"></day>
// <day value="7"></day>
// <day value="10"></day>

//*test if days/months/years will work when not in ascending order


// initialize date
today_date = new Date();
todayMonth=today_date.getMonth() + 1
todayDay=today_date.getDate();
todayYear=today_date.getFullYear();

mymonth=todayMonth;
trace("month: " + mymonth);
myday=todayDay;
trace("day: " + myday);
myyear=todayYear;
trace("year: " + myyear);

//load xml file
calendar_xml = new XML();
calendar_xml.ignoreWhite=true;
calendar_xml.load("calendar.xml")
calendar_xml.onLoad = xml_handler;

var yearNode_xml;
var monthNode_xml;
var dayNode_xml;

// executes when xml file has loaded (used as MAIN function)
function xml_handler(success)
{
if (success==true){
trace ("...xml file loaded");
//set color
//_root.myColor="0x556677";
_root.myColorHTML="#"+calendar_xml.firstChild.attributes.color;
_root.myColorAS="0x"+calendar_xml.firstChild.attributes.color;
//find today's year
yearNode_xml=findYear(myyear);
//find today's month
monthNode_xml=findMonth(yearNode_xml,mymonth);

gotoAndPlay(2);
}

else{
trace("...error loading xml file");
break;
}
}

function findYear(year_num)
{
var yearNode_xml=calendar_xml.firstChild.firstChild;

while (yearNode_xml.attributes.value!=year_num)
{
yearNode_xml=yearNode_xml.nextSibling;
if (yearNode_xml == null)
{
trace ("...no xml enteries within that year");
return 0;// error flag
}
}

trace("yearXML: " + yearNode_xml.attributes.value);
return yearNode_xml;
}

function findMonth(yearNode_xml,month_num)
{
var monthNode_xml=yearNode_xml.firstChild;

while (monthNode_xml.attributes.value!=month_num)
{
monthNode_xml=monthNode_xml.nextSibling;
if (monthNode_xml == null)
{
trace ("...no xml enteries within that month");
return 0;// error flag
}
}

trace("monthXML: " + monthNode_xml.attributes.value);
return monthNode_xml;
}

function findDay(monthNode_xml,day_num)
{
var dayNode_xml=monthNode_xml.firstChild;

while (dayNode_xml.attributes.value!=day_num)
{
dayNode_xml=dayNode_xml.nextSibling;
if (dayNode_xml == null)
{
trace ("...no xml enteries for that day");
return 0;// error flag
}
}

trace("monthXML: " + monthNode_xml.attributes.value);
return dayNode_xml;
}

function setDay(dayNode_xml,day_num,mc){
trace("day: " + day_num);
trace("dayXML: " + dayNode_xml.attributes.value);



if (dayNode_xml.attributes.value==day_num){
//-----------------------------------------------
var itemsNode_xml=dayNode_xml.firstChild;

//initialize items array
itemsNodes_xml=[];
total = dayNode_xml.childNodes.length;
//empty text boxes and initialize content
_root[mc].description="";

//loop through the items array
for(i=0;i<total;i++){
itemsNodes_xml[i]=dayNode_xml.childNodes[i];
}
trace("yes entry for this day");

while (itemsNode_xml!=null){
//reference items in items array
for(p=0;p<total;p++){
if (itemsNodes_xml[p].nodeName=="label")
{
trace("yes label: " + itemsNode_xml.nodeValue);
_root[mc].label +=itemsNodes_xml[p].firstChild.nodeValue+"\n";

}
else if (itemsNodes_xml[p].nodeName=="image" && itemsNodes_xml[p].firstChild.nodeValue!=undefined)
{
trace("yes Image");
_root[mc].square_mc.pic.loadMovie(itemsNodes_xml[p].firstChild.nodeValue);
_root[mc].label +="\n\n";
}
else if (itemsNodes_xml[p].nodeName=="description")
{
trace("yes description: " + itemsNode_xml.nodeValue);
_root
_root[mc].description +=itemsNodes_xml[p].firstChild.nodeValue+"\n\n";
}
else{
trace("error");
}

itemsNode_xml=itemsNode_xml.nextSibling;
}
}


//-----------------------------------------
dayNode_xml=dayNode_xml.nextSibling;


if (dayNode_xml == null)
{
trace ("...no more xml day enteries");
return 0;// error flag
}

}

else{
trace("no entry for this day");
}

return dayNode_xml;
}

//*** testing functions ***
//-------------------------------------------------------------------
function printGroup (groupNode_xml){
trace ("<" + groupNode_xml.nodeName + " value=" + groupNode_xml.attributes.value1 + ">");
}

//-------------------------------------------------------------------
function printItem (itemNode_xml){
trace(" <" + itemNode_xml.nodeName + " URL=" + itemNode_xml.attributes.URL + ">");
trace(" -"+itemNode_xml.firstChild.nodeValue);
}

//-------------------------------------------------------------------
function printSubgroup(subgroupNode_xml){
trace(" <" + subgroupNode_xml.nodeName + " title=" + subgroupNode_xml.attributes.title+">");
}

function printSubitem(subitemNode_xml){
trace(" <" + subitemNode_xml.nodeName + " URL=" + subitemNode_xml.attributes.URL + ">");
trace(" -"+subitemNode_xml.firstChild.nodeValue);
}

stop();[/as]

Fotograma 2
[as]// set up days in month
_root.today="Hoy: " + _root.todayDay + " / " + _root.todayMonth + " / " + _root.todayYear;
_root.dom_txt.textColor=_root.myColorAS;
_root.lun_txt.textColor=_root.myColorAS;
_root.mar_txt.textColor=_root.myColorAS;
_root.mie_txt.textColor=_root.myColorAS;
_root.jue_txt.textColor=_root.myColorAS;
_root.vie_txt.textColor=_root.myColorAS;
_root.sab_txt.textColor=_root.myColorAS;
_root.hoy_txt.textColor=_root.myColorAS;
back_btnColor=new Color(_root.btn_bkgrd_mc1);
back_btnColor.setRGB(_root.myColorAS);
forw_btnColor=new Color(_root.btn_bkgrd_mc2);
forw_btnColor.setRGB(_root.myColorAS);

month1 = 31;
month2 = 28;
month3 = 31;
month4 = 30;
month5 = 31;
month6 = 30;
month7 = 31;
month8 = 31;
month9 = 30;
month10 = 31;
month11 = 30;
month12 = 31;

// set up month names
namemonth1 = "Enero";
namemonth2 = "Febrero";
namemonth3 = "Marzo";
namemonth4 = "Abril";
namemonth5 = "Mayo";
namemonth6 = "Junio";
namemonth7 = "Julio";
namemonth8 = "Agosto";
namemonth9 = "Septiembre";
namemonth10 = "Octubre";
namemonth11 = "Noviembre";
namemonth12 = "Diciembre";[/as]

Fotograma 3
[as]// which day of week does the month begin on
juliandate = Number(Number(Number(367*myyear-int(7*(Number(myyear)+Number(int((Number(mymonth)+9)/12)))/4))+Number(int((275*mymonth)/9)))+1)+1721013.5;
mjd = juliandate-2400000.5;
whichday = mjd-int(mjd/7)*7;
whichday = Number(whichday)+3;
if (Number(whichday)>=7) {
whichday = whichday-7;
}
// initialize day and row variables
counter = 2;
currentday = Number(whichday)+1;
currentrow = 0;
daysinmonth = eval("month" add mymonth);
// check for leap year
if (Number(int(myyear/4)) == Number((myyear/4)) and Number(mymonth) == 2) {
daysinmonth = 29;
}
//initialize day1
if(_root.yearNode_xml==0 || _root.monthNode_xml==0){
_root.dayNode_xml=0;
}

else{
_root.dayNode_xml=monthNode_xml.firstChild;
_root.dayNode_xml=setDay(_root.dayNode_xml,1,"square1");
}

//set day1 values


while (Number(counter)<=Number(daysinmonth)) {
// end of week? start new row
if (Number(currentday) == 7) {
currentday = 0;
currentrow = Number(currentrow)+1;
}
// duplicate square for each day in month and move to correct position and intialize values
duplicateMovieClip("/square1", "square" add counter, counter);
setProperty("/square" add counter, _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*currentday));
setProperty("/square" add counter, _y, Number(getProperty("/square1", _y))+Number(getProperty("/square1", _height)*currentrow));
set("/square" add counter add ":daynum", counter);

_root.dayNode_xml=setDay(_root.dayNode_xml,counter,"square"+counter);

counter = Number(counter)+1;
currentday = Number(currentday)+1;
}
// move first day into right spot
setProperty("/square1", _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*whichday));


// highlight current day
if((_root.myyear==_root.todayYear)&&(_root.mymonth==_root.todayMonth)){
var mc="square"+myday;
_root[mc].daynum_txt.textColor=0x0066ff;
}

// month title
monthtitle = eval("namemonth" add mymonth) add " " add myyear;
trace("MONTHTITLE: " + monthtitle);
_root.monthtitle_txt.text=monthtitle;
_root.monthtitle_txt.textColor=_root.myColorAS;
[/as]

Fotograma 4 tiene solo un [as]stop();[/as]


Por favor muchachos, no posteo con frecuencia o me atreveria a decir que nunca lo he hecho, pero 100pre ando revisando los tutos de aca que son muy buenos y esta vez necesito urgentemente su ayuda.... gracias :cry:

Por jakiras

Claber

148 de clabLevel



Genero:Femenino  

msie8
Citar            
MensajeEscrito el 21 Sep 2009 09:36 pm
Hola a todos, interesante tema necesito que me ayuden; descargue un calendario el cual emplea estos codigos que adjunto; he conseguido modificar la interfaz original y le di un aspecto mas personal; pero mi problema viene dado porque quiero cargar una imagen desde el archivo xml (q tambn trae) en un popup que es llamado desde la biblioteca por un boton al ser presionado, este popup me muestra informacion textual q uno le coloca en el archivo xml; pero quiero una forma de insertar tambien en ese popup una imagen desde ese mismo archivo. yo coloque dentro del popup un movieclip vacio con el nombre pic el cual queria reemplazar por la imagen pero por mas que intento no lo consigo; si pueden ayudarme se los agradeceria mucho.

Este codigo se encuentra en un fotograma del popup

Código ActionScript :

_root.forwd_btn.enabled=false;
_root.back_btn.enabled=false;
mydate_txt.textColor=_root.myColorAS;
//CSS
trace(_root.myColor);
var styles = new TextField.StyleSheet();
styles.setStyle("a:link", 
  {color: _root.myColorHTML,textDecoration: 'underline'} 
);
styles.setStyle("a:hover", 
  {color: _root.myColorHTML,textDecoration: 'none'}
);
popup_txt.styleSheet = styles;
stop();
for (var i=1;i<=31;i++){
   var mc="square" + i;
   _root[mc].square_mc.square_btn.enabled=false;
}



Este codigo es el que se encuentra en el boton

[as]on (release) {
var month_path="namemonth" + _root.mymonth;
_root.print_btn.enabled=false;
_root.attachMovie("popup","popup1",100);
_root.popup1._x=2.5;
_root.popup1._y=2.5;
_root.popup1.mydate=this._parent.daynum+" "+ _root[month_path] + ", " + _root.myyear;

if(this._parent.description==undefined){
_root.popup1.description="";
}else{
_root.popup1.description=this._parent.description;//description stored in corresponding square (day)
}
}
[as]




Estos son los codigos de la animacion.

Fotograma 1
[as]//XML file
//---------------------------------------------------
//LOCATION: assets/calendar.xml
//SOURCE:
//<calendar color="0x552233">
// <year value="2004">
// <month value="3">
// <day value="10">
// <image>this appears on the calendar day</image>
// <label>this appears on the calendar day</label>
// <description>this appears in the popup</description>
// </day>
// </month>
// </year>
//</calendar>
// day values must be in ascending order
// EX: <day value="3"></day>
// <day value="7"></day>
// <day value="10"></day>

//*test if days/months/years will work when not in ascending order


// initialize date
today_date = new Date();
todayMonth=today_date.getMonth() + 1
todayDay=today_date.getDate();
todayYear=today_date.getFullYear();

mymonth=todayMonth;
trace("month: " + mymonth);
myday=todayDay;
trace("day: " + myday);
myyear=todayYear;
trace("year: " + myyear);

//load xml file
calendar_xml = new XML();
calendar_xml.ignoreWhite=true;
calendar_xml.load("calendar.xml")
calendar_xml.onLoad = xml_handler;

var yearNode_xml;
var monthNode_xml;
var dayNode_xml;

// executes when xml file has loaded (used as MAIN function)
function xml_handler(success)
{
if (success==true){
trace ("...xml file loaded");
//set color
//_root.myColor="0x556677";
_root.myColorHTML="#"+calendar_xml.firstChild.attributes.color;
_root.myColorAS="0x"+calendar_xml.firstChild.attributes.color;
//find today's year
yearNode_xml=findYear(myyear);
//find today's month
monthNode_xml=findMonth(yearNode_xml,mymonth);

gotoAndPlay(2);
}

else{
trace("...error loading xml file");
break;
}
}

function findYear(year_num)
{
var yearNode_xml=calendar_xml.firstChild.firstChild;

while (yearNode_xml.attributes.value!=year_num)
{
yearNode_xml=yearNode_xml.nextSibling;
if (yearNode_xml == null)
{
trace ("...no xml enteries within that year");
return 0;// error flag
}
}

trace("yearXML: " + yearNode_xml.attributes.value);
return yearNode_xml;
}

function findMonth(yearNode_xml,month_num)
{
var monthNode_xml=yearNode_xml.firstChild;

while (monthNode_xml.attributes.value!=month_num)
{
monthNode_xml=monthNode_xml.nextSibling;
if (monthNode_xml == null)
{
trace ("...no xml enteries within that month");
return 0;// error flag
}
}

trace("monthXML: " + monthNode_xml.attributes.value);
return monthNode_xml;
}

function findDay(monthNode_xml,day_num)
{
var dayNode_xml=monthNode_xml.firstChild;

while (dayNode_xml.attributes.value!=day_num)
{
dayNode_xml=dayNode_xml.nextSibling;
if (dayNode_xml == null)
{
trace ("...no xml enteries for that day");
return 0;// error flag
}
}

trace("monthXML: " + monthNode_xml.attributes.value);
return dayNode_xml;
}

function setDay(dayNode_xml,day_num,mc){
trace("day: " + day_num);
trace("dayXML: " + dayNode_xml.attributes.value);



if (dayNode_xml.attributes.value==day_num){
//-----------------------------------------------
var itemsNode_xml=dayNode_xml.firstChild;

//initialize items array
itemsNodes_xml=[];
total = dayNode_xml.childNodes.length;
//empty text boxes and initialize content
_root[mc].description="";

//loop through the items array
for(i=0;i<total;i++){
itemsNodes_xml[i]=dayNode_xml.childNodes[i];
}
trace("yes entry for this day");

while (itemsNode_xml!=null){
//reference items in items array
for(p=0;p<total;p++){
if (itemsNodes_xml[p].nodeName=="label")
{
trace("yes label: " + itemsNode_xml.nodeValue);
_root[mc].label +=itemsNodes_xml[p].firstChild.nodeValue+"\n";

}
else if (itemsNodes_xml[p].nodeName=="image" && itemsNodes_xml[p].firstChild.nodeValue!=undefined)
{
trace("yes Image");
_root[mc].square_mc.pic.loadMovie(itemsNodes_xml[p].firstChild.nodeValue);
_root[mc].label +="\n\n";
}
else if (itemsNodes_xml[p].nodeName=="description")
{
trace("yes description: " + itemsNode_xml.nodeValue);
_root
_root[mc].description +=itemsNodes_xml[p].firstChild.nodeValue+"\n\n";
}
else{
trace("error");
}

itemsNode_xml=itemsNode_xml.nextSibling;
}
}


//-----------------------------------------
dayNode_xml=dayNode_xml.nextSibling;


if (dayNode_xml == null)
{
trace ("...no more xml day enteries");
return 0;// error flag
}

}

else{
trace("no entry for this day");
}

return dayNode_xml;
}

//*** testing functions ***
//-------------------------------------------------------------------
function printGroup (groupNode_xml){
trace ("<" + groupNode_xml.nodeName + " value=" + groupNode_xml.attributes.value1 + ">");
}

//-------------------------------------------------------------------
function printItem (itemNode_xml){
trace(" <" + itemNode_xml.nodeName + " URL=" + itemNode_xml.attributes.URL + ">");
trace(" -"+itemNode_xml.firstChild.nodeValue);
}

//-------------------------------------------------------------------
function printSubgroup(subgroupNode_xml){
trace(" <" + subgroupNode_xml.nodeName + " title=" + subgroupNode_xml.attributes.title+">");
}

function printSubitem(subitemNode_xml){
trace(" <" + subitemNode_xml.nodeName + " URL=" + subitemNode_xml.attributes.URL + ">");
trace(" -"+subitemNode_xml.firstChild.nodeValue);
}

stop();[/as]

Fotograma 2
[as]// set up days in month
_root.today="Hoy: " + _root.todayDay + " / " + _root.todayMonth + " / " + _root.todayYear;
_root.dom_txt.textColor=_root.myColorAS;
_root.lun_txt.textColor=_root.myColorAS;
_root.mar_txt.textColor=_root.myColorAS;
_root.mie_txt.textColor=_root.myColorAS;
_root.jue_txt.textColor=_root.myColorAS;
_root.vie_txt.textColor=_root.myColorAS;
_root.sab_txt.textColor=_root.myColorAS;
_root.hoy_txt.textColor=_root.myColorAS;
back_btnColor=new Color(_root.btn_bkgrd_mc1);
back_btnColor.setRGB(_root.myColorAS);
forw_btnColor=new Color(_root.btn_bkgrd_mc2);
forw_btnColor.setRGB(_root.myColorAS);

month1 = 31;
month2 = 28;
month3 = 31;
month4 = 30;
month5 = 31;
month6 = 30;
month7 = 31;
month8 = 31;
month9 = 30;
month10 = 31;
month11 = 30;
month12 = 31;

// set up month names
namemonth1 = "Enero";
namemonth2 = "Febrero";
namemonth3 = "Marzo";
namemonth4 = "Abril";
namemonth5 = "Mayo";
namemonth6 = "Junio";
namemonth7 = "Julio";
namemonth8 = "Agosto";
namemonth9 = "Septiembre";
namemonth10 = "Octubre";
namemonth11 = "Noviembre";
namemonth12 = "Diciembre";[/as]

Fotograma 3
[as]// which day of week does the month begin on
juliandate = Number(Number(Number(367*myyear-int(7*(Number(myyear)+Number(int((Number(mymonth)+9)/12)))/4))+Number(int((275*mymonth)/9)))+1)+1721013.5;
mjd = juliandate-2400000.5;
whichday = mjd-int(mjd/7)*7;
whichday = Number(whichday)+3;
if (Number(whichday)>=7) {
whichday = whichday-7;
}
// initialize day and row variables
counter = 2;
currentday = Number(whichday)+1;
currentrow = 0;
daysinmonth = eval("month" add mymonth);
// check for leap year
if (Number(int(myyear/4)) == Number((myyear/4)) and Number(mymonth) == 2) {
daysinmonth = 29;
}
//initialize day1
if(_root.yearNode_xml==0 || _root.monthNode_xml==0){
_root.dayNode_xml=0;
}

else{
_root.dayNode_xml=monthNode_xml.firstChild;
_root.dayNode_xml=setDay(_root.dayNode_xml,1,"square1");
}

//set day1 values


while (Number(counter)<=Number(daysinmonth)) {
// end of week? start new row
if (Number(currentday) == 7) {
currentday = 0;
currentrow = Number(currentrow)+1;
}
// duplicate square for each day in month and move to correct position and intialize values
duplicateMovieClip("/square1", "square" add counter, counter);
setProperty("/square" add counter, _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*currentday));
setProperty("/square" add counter, _y, Number(getProperty("/square1", _y))+Number(getProperty("/square1", _height)*currentrow));
set("/square" add counter add ":daynum", counter);

_root.dayNode_xml=setDay(_root.dayNode_xml,counter,"square"+counter);

counter = Number(counter)+1;
currentday = Number(currentday)+1;
}
// move first day into right spot
setProperty("/square1", _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*whichday));


// highlight current day
if((_root.myyear==_root.todayYear)&&(_root.mymonth==_root.todayMonth)){
var mc="square"+myday;
_root[mc].daynum_txt.textColor=0x0066ff;
}

// month title
monthtitle = eval("namemonth" add mymonth) add " " add myyear;
trace("MONTHTITLE: " + monthtitle);
_root.monthtitle_txt.text=monthtitle;
_root.monthtitle_txt.textColor=_root.myColorAS;
[/as]

Fotograma 4 tiene solo un [as]stop();[/as]


Por favor muchachos, no posteo con frecuencia o me atreveria a decir que nunca lo he hecho, pero 100pre ando revisando los tutos de aca que son muy buenos y esta vez necesito urgentemente su ayuda.... gracias :cry:

Por jakiras

Claber

148 de clabLevel



Genero:Femenino  

msie8

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.