Comunidad de diseño web y desarrollo en internet online

cargar textos o imagenes en as

Citar            
MensajeEscrito el 01 Jun 2007 07:34 pm
que tal, tengo el siguiente codigo y me gustaría que en los diferentes items poder cargar textos o imagenes. Por favor, alguien podría ayudarme?



menuItems=[
{text:"INFORMATION", swfURL:"", subItems:[
{text:"WHO WE ARE", swfURL:"", subItems:[
{text:"MANAGEMENT", swfURL:""},
{text:"NON-EXECUTIVE\nDIRECTORS", swfURL:"", subItems:[
{text:"MIKE NEWTON\n-CHAIRMAN", swfURL:""},
{text:"RICHARD HARGREAVES", swfURL:""}
]},
{text:"BUSINESS\nDEVELOPMENT", swfURL:"", subItems:[
{text:"MARC RYAN\n-NEW BUSINESS EXEC", swfURL:""}
]}
]},
{text:"PRESS", swfURL:"", subItems:[
{text:"PRINT", swfURL:"", subItems:[
{text:"DAILY TELEGRAPH", swfURL:""},
{text:"WEBSPACE MAGAZINE", swfURL:""}
]},
{text:"ONLINE", swfURL:"", subItems:[
{text:"NET IMPERATIVE", swfURL:""}
]}
]},
{text:"CONTACT", swfURL:""},
{text:"LOCATION", swfURL:""},
{text:"THE NAME", swfURL:""}
]},
{text:"CUSTOMER\nSOLUTIONS", swfURL:""},
{text:"PARTNER PROGRAMME", swfURL:"", subItems:[
{text:"TOOLKIT", swfURL:"", subItems:[
{text:"CREATOR", swfURL:""},
{text:"VISUALIZER", swfURL:""}
]},
{text:"TECHNOLOGY PARTNER", swfURL:"", subItems:[
{text:"AUTONOMY", swfURL:""},
{text:"MACROMEDIA", swfURL:""},
{text:"COMPAQ", swfURL:""}
]}
]},
{text:"WHAT WE DO", swfURL:"", subItems:[
{text:"PROVIDE INFORMATION\nACCESS", swfURL:"", subItems:[
{text:"DESKTOP COMPUTERS", swfURL:""},
{text:"POCKET PC", swfURL:""},
{text:"IDTV", swfURL:""}
]},
{text:"PRODUCTS", swfURL:"", subItems:[
{text:"CREATOR", swfURL:""},
{text:"NAVIGATOR", swfURL:""}
]},
{text:"ORGANISE THE WEB", swfURL:"", subItems:[
{text:"FETCH", swfURL:""}, {text:"andresssssssssss", swfURL:""},
{text:"THE WEB INDEX", swfURL:""}
]}
]}
];

// quadratic easing in/out - acceleration until halfway, then deceleration
Math.easeInOutQuad = function (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
};


// Model --------------------------------------------------------------------

function MenuModel(menuItems) {
this.items=menuItems;
this.addIDandParent(this.items);
ASBroadcaster.initialize(this);
this.activeItem=null;
}

// fügt den Menüpunkten eine ID und einen Verweis auf den übergeordneten Menüpunkt hinzu
MenuModel.prototype.addIDandParent = function(items,id,parent) {
if (!id) {
var id=1;
var parent=null;
}
for (var i=0; i<items.length; i++) {
items[i].ID=id++;
items[i].parent=parent;
if (items[i].subItems) id=this.addIDandParent(items[i].subItems,id,items[i]);
}
return id;
}

MenuModel.prototype.getItems = function() {
return this.items;
}

MenuModel.prototype.setActiveItem = function(item) {
if (this.activeItem==item) this.activeItem=this.activeItem.parent;
else this.activeItem=item;
this.broadcastMessage("onUpdate",this.activeItem);
}

// Controller --------------------------------------------------------------------

function MenuController(model){
this.model=model;
}

MenuController.prototype.goTo = function(item) {
this.model.setActiveItem(item);
}

// View --------------------------------------------------------------------

function MenuView(model, controller){
this.model=model;
this.model.addListener(this);
this.controller=controller;
this.order=[{col:2, row:2},{col:1, row:2},{col:2, row:1},{col:1, row:1},{col:0, row:2}]
this.itemWidth=120;
this.itemHeight=120;

// Container für Menüpunkte
this.mcMenu=_root.createEmptyMovieClip("mcMenu",0);
this.mcMenu._x=-Math.round(this.itemWidth/2);
this.mcMenu._y=-Math.round(this.itemHeight/2);

// Maske des Containers
var mc=_root.createEmptyMovieClip("mcMenuMask",1);
var w=this.itemWidth*3;
var h=this.itemHeight*3;
mc.beginFill(0x000000,0);
mc.lineTo(w,0); mc.lineTo(w,h); mc.lineTo(0,h); mc.lineTo(0,0);
mc.endFill();
this.mcMenu.setMask(mc);

// Textfeld zur Anzeige des Pfades
_root.createTextField("tfMenuPath",2,10,370,700,20);
var tf=_root.tfMenuPath;
tf.embedFonts=true;
tf.selectable=false;
tf.html=true;
tf.items=new Array();
// wird vom Model aufgerufen, nachdem sich der aktive Menüpunkt geändert hat
tf.onUpdate = function(item) {
var path;
var i=0;
while (item) {
this.items[i]=item;
if (i==0) path=" . "+"<font color='#ffffff'>"+item.text+"</font>";
else path=" . "+"<a href='asfunction:"+targetPath(this)+".goTo,"+i+"'>"+item.text+"</a>"+path;
i++;
item=item.parent;
}
path=path.split("\n").join(" ");
path="<a href='asfunction:"+targetPath(this)+".goTo'>HOME</a>"+path;
this.htmlText="<font face='Verdana' size='10px' color='#aaaaaa'>"+path+"</font>";
}
tf.goTo = function(item) { controller.goTo(this.items[item]); }
tf.onUpdate();
this.model.addListener(tf);

this.drawItems(this.model.getItems(),0,0,0);
};

// zeichnet Menüpunkte in den Container this.mcMenu
MenuView.prototype.drawItems = function(items,level,x,y) {
var w=this.itemWidth;
var h=this.itemHeight;
var scale=Math.pow((1/3),level);
for (var i=0; i<items.length; i++) {
var col=this.order[i].col;
var row=this.order[i].row;
var mc=this.mcMenu.createEmptyMovieClip("mc"+items[i].ID,items[i].ID);
mc._xscale=mc._yscale=scale*100;
mc._x=x+col*w*scale;
mc._y=y+row*h*scale;
mc.beginFill(0xcc7750-500000*level-4000000*i,100);
mc.lineTo(w,0); mc.lineTo(w,h); mc.lineTo(0,h); mc.lineTo(0,0);
mc.endFill();
mc.createTextField("textfield",0,5,6,w,30);
mc.textfield.embedFonts=true;
mc.textfield.selectable=false;
mc.textfield.text=items[i].text;
mc.textfield.setTextFormat(new TextFormat("Verdana",9,0xffffff));
mc.item=items[i];
mc.controller=this.controller;
mc.onRelease=function() { this.controller.goTo(this.item); }

if (items[i].subItems) this.drawItems(items[i].subItems,level+1,mc._x,mc._y);
}
}

// wird vom Model aufgerufen, nachdem sich der aktive Menüpunkt geändert hat
MenuView.prototype.onUpdate = function(item) {
var level=item ? 0 : -1;
var i=item;
while (i=i.parent) level++;

var scale=Math.pow(3,level+1);
var mc=this.mcMenu["mc"+item.ID];

var steps=10;
var xStart=this.mcMenu._x;
var yStart=this.mcMenu._y;
var scaleStart=this.mcMenu._xscale;
var xDiff=((level<>-1) ? (-mc._x*scale) : -60) - xStart;
var yDiff=((level<>-1) ? (-mc._y*scale) : -60) - yStart;
var scaleDiff=(scale*100) - scaleStart;
var t=0;
// realisiert das Zoomen
this.mcMenu.onEnterFrame = function() {
var ease=Math.easeInOutQuad;
this._x=ease(t, xStart, xDiff, steps);
this._y=ease(t, yStart, yDiff, steps);
this._xscale=this._yscale=ease(t, scaleStart, scaleDiff, steps);;
if (t++==steps) this.onEnterFrame=null;
}
}

// Main --------------------------------------------------------------------

menu=new Object();
menu.model=new MenuModel(menuItems);
menu.controller=new MenuController(menu.model);
menu.view=new MenuView(menu.model, menu.controller);


Volver arriba
Dejar de observar este tema Mostrar mensajes de anteriores: Todos los mensajes1 Día7 Días2 Semanas1 Mes3 Meses6 Meses1 Año El más antiguo primeroEl más reciente primero


Página 1 de 1 Todas las horas son GMT + 2 Horas
Fecha y hora actual: Vie Jun 01, 2007 9:32 pm Foros de discusión
Puede publicar nuevos temas en este foro
Puede responder a temas en este foro
Puede editar sus mensajes en este foro
Puede borrar sus mensajes en este foro
Puede votar en encuestas en este foro

Por incubo

53 de clabLevel



 

msie
Citar            
MensajeEscrito el 02 Jun 2007 09:50 am
Etiquetas code etiquetas code....

Por One

Claber

1488 de clabLevel

5 tutoriales

Genero:Masculino  

Programador Web

firefox
Citar            
MensajeEscrito el 02 Jun 2007 07:13 pm
puedes darme un ejemplo por favor, si quisiera yo introducir un boton en uno de los items para por ejempolo que me dirija a otro sitio web.
Te agradezco enormemente.

Por incubo

53 de clabLevel



 

firefox
Citar            
MensajeEscrito el 02 Jun 2007 07:45 pm
Oye podrias dar un poco del contexto en el que te encuentras por que no entiendo NADA NADITA tu codigo y pus asi ni como ayudarte.

Osea que onda con menu item dijo si entiendo que es pero no como funciona ni quien lo hizo

haaa y usa bloke de codigo osea

cuando postes selecciona el codigo que pegaste y dale clic al boton code que esta abajo de Asunto

mmmm bueno espero tu respuesta

Por Gz.Francisco

378 de clabLevel



Genero:Masculino  

Programador economista y buzo

firefox
Citar            
MensajeEscrito el 02 Jun 2007 08:26 pm
antes que nada agradezco tu preocupación sobre mi problema. Eso es ya muy valorable y amerita decirlo.
El punto, con respecto al dilema con el script es que quizá sea bueno que descargues todo el flash desde aqui http://www.flashforum.de/forum/showthread.php?t=234244&highlight=relevare , y luego me comentes como hago para el cargado de imagenes, botones y demás dentro de los items que se van desplegando.

Por incubo

53 de clabLevel



 

firefox
Citar            
MensajeEscrito el 02 Jun 2007 11:41 pm
Oye neta que me gustaría ayudarte pero no le hago al alemán, (creo que es alemán) :lol:
Pero no tienes por hay el ZIP que contenga todo lo que se necesita?
voy a estudiar tu script pero si tienes el zip o rar que contenga todo pues pasalo :cool:

Creo que lo que quieres es hacer un menu dinámico con submenus dinámicos no?
por que si es asi existe un EJEMPLO en las capetas de flash busca en la ayuda el ejemplo XMLMENU

Por Gz.Francisco

378 de clabLevel



Genero:Masculino  

Programador economista y buzo

firefox

 

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