Texto Flash descripción cuestión de estilo

Nota Octubre 14th, 2009, 6:50 pm

Hola,

He heredado una visita virtual Flash de un colega anterior y han llegado a un obstáculo. La punta de la herramienta que estoy usando se basa en "alt" etiqueta de mi documento XML. Tengo que hacer de los nombres científicos en cursiva, pero parece que no puede hacer sólo una pocas palabras en cursiva.

En el documento XML que puede especificar el altFont y hacer que la cursiva toda la línea...pero en realidad sólo necesita especificar unas palabras en la frase.

Yo estaba pensando que tal vez tengo que agregar algo a la ActionScript Flash y especificar un nuevo "atributo"? Soy un diseñador y no un promotor así lo esperamos que hay alguien por ahí que me podría apuntar en la dirección correcta?

A continuación se muestra el código ActionScript...

Thanks heaps!

ACTIONSCRIPT Código: [ Download ] [ Select ]
// Tooltips plugin
 
var id:String="Tootips";
var version:String="1.0";
var panoController:Object=null;
var pano:Object=null;
var hotspots:Object;
var waitTimer:Timer;
 
// this function is called on plugin's start
function init (panoMain:Object) {
   panoController = panoMain;
   if (panoMain.addExternal(this)) {
      waitTimer = new Timer(50);
      waitTimer.addEventListener(TimerEvent.TIMER, waitHotspots, false, 0, true);
      waitTimer.start();
   }     
}
 
// this function is called when new panorama is loading
function newPano(link:Object) {
   pano = link;
}
 
// wait for Hotspots plugin to load before starting tooltips
function waitHotspots (event:Event) {
   if (panoController.externals.hotspots!=null) {
      waitTimer.stop();
      waitTimer = null
      hotspots = panoController.externals.hotspots;
      hotspots.addEventListener(MouseEvent.MOUSE_OVER, doOver, false, 0, true);
      hotspots.addEventListener(MouseEvent.MOUSE_OUT, doOut, false, 0, true);
      hotspots.addEventListener(MouseEvent.CLICK, doOut, false, 0, true);
   }
}
 
var animationTimer:Timer;
var speed:Number;
var currentObject:Object;
var alphaMax:Number = 1;
var alphaMin:Number = -1.4;
var alphaPlus:Number = 0.2;
var alphaMinus:Number = -0.08;
 
visible = false;
alpha = alphaMin;
tip.scale9Grid = new Rectangle(5, 5, tip.width-10, tip.height-10);
tip_txt.autoSize = TextFieldAutoSize.LEFT;
 
function doOver (event:Event) {
   // find object with property "attributes" (all hotspots has this object)
   var obj:Object = event.target;
   while (!obj.hasOwnProperty("attributes")) {
      if (obj.hasOwnProperty("parent")) {
         obj = obj.parent;
      } else {
         return;
      }
   }
   // try to get propery alt (stored in XML: <spot url="1.jpg" alt="My Picture" />)
   var text:String = obj.attributes.getParam("alt");
   if (text!=null) {
      currentObject = obj;
      // if text contais \n, it is multilines
      if (text.indexOf("\n")!=-1) {
         text = text.replace(/\n/g, "\n")
      }
      tip_txt.text = text;
      tip.width = tip_txt.width+10;
      tip.height = tip_txt.height+4;
      // start animation
      speed = alphaPlus;
      visible = true;
      if (animationTimer!=null) {
         animationTimer.stop();
      }
      animationTimer = new Timer(30);
      animationTimer.addEventListener(TimerEvent.TIMER, animation, false, 0, true);
      animationTimer.start();
   }
}
 
function doOut (event:Event) {
   speed = alphaMinus;
}
 
function animation (event:Event) {
   if (speed>0) {
      if (alpha < alphaMax) {
         alpha += speed;
      } else {
         alpha = alphaMax;
      }
      x = parent.mouseX-8;
      y = parent.mouseY+20;
      //
      if (x<0) {
         x = 0;
      }
      if (x+width>pano.width) {
         x = pano.width-width;
      }
      if (y+height>pano.height) {
         y = pano.height-height;
      }
      if (!currentObject.visible) {
         speed = alphaMinus;
      }
   } else {
      if (alpha > alphaMin) {
         alpha += speed;
      } else {
         alpha = alphaMin;
         animationTimer.stop();
         animationTimer = null;
      }
   }
}
 
function remove () {
   hotspots.removeEventListener(MouseEvent.MOUSE_OVER, doOver);
   hotspots.removeEventListener(MouseEvent.MOUSE_OUT, doOut);
   if (animationTimer!=null) {
      animationTimer.stop();
   }
   animationTimer = null;
}
  1. // Tooltips plugin
  2.  
  3. var id:String="Tootips";
  4. var version:String="1.0";
  5. var panoController:Object=null;
  6. var pano:Object=null;
  7. var hotspots:Object;
  8. var waitTimer:Timer;
  9.  
  10. // this function is called on plugin's start
  11. function init (panoMain:Object) {
  12.    panoController = panoMain;
  13.    if (panoMain.addExternal(this)) {
  14.       waitTimer = new Timer(50);
  15.       waitTimer.addEventListener(TimerEvent.TIMER, waitHotspots, false, 0, true);
  16.       waitTimer.start();
  17.    }     
  18. }
  19.  
  20. // this function is called when new panorama is loading
  21. function newPano(link:Object) {
  22.    pano = link;
  23. }
  24.  
  25. // wait for Hotspots plugin to load before starting tooltips
  26. function waitHotspots (event:Event) {
  27.    if (panoController.externals.hotspots!=null) {
  28.       waitTimer.stop();
  29.       waitTimer = null
  30.       hotspots = panoController.externals.hotspots;
  31.       hotspots.addEventListener(MouseEvent.MOUSE_OVER, doOver, false, 0, true);
  32.       hotspots.addEventListener(MouseEvent.MOUSE_OUT, doOut, false, 0, true);
  33.       hotspots.addEventListener(MouseEvent.CLICK, doOut, false, 0, true);
  34.    }
  35. }
  36.  
  37. var animationTimer:Timer;
  38. var speed:Number;
  39. var currentObject:Object;
  40. var alphaMax:Number = 1;
  41. var alphaMin:Number = -1.4;
  42. var alphaPlus:Number = 0.2;
  43. var alphaMinus:Number = -0.08;
  44.  
  45. visible = false;
  46. alpha = alphaMin;
  47. tip.scale9Grid = new Rectangle(5, 5, tip.width-10, tip.height-10);
  48. tip_txt.autoSize = TextFieldAutoSize.LEFT;
  49.  
  50. function doOver (event:Event) {
  51.    // find object with property "attributes" (all hotspots has this object)
  52.    var obj:Object = event.target;
  53.    while (!obj.hasOwnProperty("attributes")) {
  54.       if (obj.hasOwnProperty("parent")) {
  55.          obj = obj.parent;
  56.       } else {
  57.          return;
  58.       }
  59.    }
  60.    // try to get propery alt (stored in XML: <spot url="1.jpg" alt="My Picture" />)
  61.    var text:String = obj.attributes.getParam("alt");
  62.    if (text!=null) {
  63.       currentObject = obj;
  64.       // if text contais \n, it is multilines
  65.       if (text.indexOf("\n")!=-1) {
  66.          text = text.replace(/\n/g, "\n")
  67.       }
  68.       tip_txt.text = text;
  69.       tip.width = tip_txt.width+10;
  70.       tip.height = tip_txt.height+4;
  71.       // start animation
  72.       speed = alphaPlus;
  73.       visible = true;
  74.       if (animationTimer!=null) {
  75.          animationTimer.stop();
  76.       }
  77.       animationTimer = new Timer(30);
  78.       animationTimer.addEventListener(TimerEvent.TIMER, animation, false, 0, true);
  79.       animationTimer.start();
  80.    }
  81. }
  82.  
  83. function doOut (event:Event) {
  84.    speed = alphaMinus;
  85. }
  86.  
  87. function animation (event:Event) {
  88.    if (speed>0) {
  89.       if (alpha < alphaMax) {
  90.          alpha += speed;
  91.       } else {
  92.          alpha = alphaMax;
  93.       }
  94.       x = parent.mouseX-8;
  95.       y = parent.mouseY+20;
  96.       //
  97.       if (x<0) {
  98.          x = 0;
  99.       }
  100.       if (x+width>pano.width) {
  101.          x = pano.width-width;
  102.       }
  103.       if (y+height>pano.height) {
  104.          y = pano.height-height;
  105.       }
  106.       if (!currentObject.visible) {
  107.          speed = alphaMinus;
  108.       }
  109.    } else {
  110.       if (alpha > alphaMin) {
  111.          alpha += speed;
  112.       } else {
  113.          alpha = alphaMin;
  114.          animationTimer.stop();
  115.          animationTimer = null;
  116.       }
  117.    }
  118. }
  119.  
  120. function remove () {
  121.    hotspots.removeEventListener(MouseEvent.MOUSE_OVER, doOver);
  122.    hotspots.removeEventListener(MouseEvent.MOUSE_OUT, doOut);
  123.    if (animationTimer!=null) {
  124.       animationTimer.stop();
  125.    }
  126.    animationTimer = null;
  127. }
Moderator Remark: added code tags. Please use [code=actionscript]{code goes here[/code] when posting actionscript code. Thanks
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Octubre 14th, 2009, 6:50 pm

Nota Octubre 15th, 2009, 11:34 pm

usted puede utilizar la propiedad para htmlText tip_txt;
así, se
tip_txt.html = true;
(establecer este después de la línea: tip_txt.autoSize = TextFieldAutoSize.LEFT;)
entonces, en lugar de
tip_txt.text = texto;
tip_txt.htmlText uso = texto;
Y en el xml, las palabras en cursiva, lugar <i> palabra </ i>
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Nota Octubre 18th, 2009, 3:10 pm

IceCold escribió:
usted puede utilizar la propiedad para htmlText tip_txt;
así, se
tip_txt.html = true;
(establecer este después de la línea: tip_txt.autoSize = TextFieldAutoSize.LEFT;)
entonces, en lugar de
tip_txt.text = texto;
tip_txt.htmlText uso = texto;
Y en el xml, las palabras en cursiva, lugar <i> palabra </ i>



Hola ICECOLD,

Gracias por su respuesta. He insertado el código en mi documento de Flash (con ActionScript 3. 0), pero estoy recibiendo este error:

1119: El acceso de HTML, posiblemente, propiedad no definida a través de una referencia con flash.text tipo estático: TextField.
Fuente: tip_txt.html = true;

Por lo tanto, la descripción ya no funciona.

Lo siento, simplemente no sabemos lo suficiente acerca de ActionScript para poder fijar!

Su ayuda sería de nuevo más apreciados.

ambiente.

Nota Octubre 19th, 2009, 2:00 am

Parece que la propiedad del HTML ya no es necesaria en AS3,
para quitar eso.
También puedes ayudar a vivir de Adobe: http://livedocs.adobe.com/flash/9.0/Act ... l#htmlText
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Nota Octubre 19th, 2009, 9:15 pm

gracias!

mi doc XML se niega a trabajar al insertar las etiquetas de cursiva...Ill seguir intentando y ver que puedo conseguir que funcione...Gracias de nuevo por tu ayuda.

ambiente

Nota Octubre 20th, 2009, 12:03 am

uso CDATA. es decir:
xml <..... >
<items>
<item> <! [CDATA mi texto con etiquetas que se <i> no permitido </ i> por XML ]]> </ item>
</ items>

las cadenas en negrita en rojo son el comienzo CDATA y etiqueta final.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Nota Octubre 20th, 2009, 3:02 pm

Hola,

Gracias de nuevo!

He probado esto, pero creo que el documento XML funciona de manera diferente .. aquí es uno de los elementos de descripción que he tratado de cambiar:

<ID in situ = "01rock" vinculado = "pano01" url = "/ includes / agua / virtual-tours / images / photo.png" pan = "-1" inclinación = "0" profundidad = "-120" escalables = " 0 "alt =" Manglar Nerita (balteata Nerita) "
onClick = "01rockInfo. visible + = 1 "/>
<ID in situ = "01rockInfo" vinculado = "pano01" url = "images/smithspoint-01/image1.jpg" estática = "1" de profundidad = "120" visible = "0"
suavizado = "0" brillo = "100" glowColor = " #FFFFFF "glowBlur =" 2 "glowInner =" 1 "sombra =" 1 "shadowDistance =" 3 "shadowAlpha =" 0. 49 "
onClick = "visible = 0" onOver = "" onOut = "" />

Su la etiqueta alt (las palabras entre paréntesis) que quiero parcialmente italicise.

ambiente

Nota Octubre 21st, 2009, 3:37 am

entonces sólo reemplaza los corchetes, como en este ejemplo.
Código: [ Download ] [ Select ]
function stringReplace(block:String, find:String, replace:String):String
{
    return block.split(find).join(replace);
}

var altString:String = "Mangrove Nerita (Nerita balteata)"; // this you'll get from
altString = stringReplace(altString, "(", "(<i>");
altString = stringReplace(altString, ")", "</i>)");
trace(altString);
  1. function stringReplace(block:String, find:String, replace:String):String
  2. {
  3.     return block.split(find).join(replace);
  4. }
  5. var altString:String = "Mangrove Nerita (Nerita balteata)"; // this you'll get from
  6. altString = stringReplace(altString, "(", "(<i>");
  7. altString = stringReplace(altString, ")", "</i>)");
  8. trace(altString);


en el código será:
Código: [ Download ] [ Select ]
 var text:String = obj.attributes.getParam("alt");
  if (text!=null) {
    currentObject = obj;
    // if text contais \n, it is multilines
    if (text.indexOf("\n")!=-1) {
     text = text.replace(/\n/g, "\n")
    }
    text = stringReplace(text, "(", "(<i>");
    text = stringReplace(text, ")", "</i>)");
    ...
  1.  var text:String = obj.attributes.getParam("alt");
  2.   if (text!=null) {
  3.     currentObject = obj;
  4.     // if text contais \n, it is multilines
  5.     if (text.indexOf("\n")!=-1) {
  6.      text = text.replace(/\n/g, "\n")
  7.     }
  8.     text = stringReplace(text, "(", "(<i>");
  9.     text = stringReplace(text, ")", "</i>)");
  10.     ...
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Nota Octubre 27th, 2009, 5:26 pm

gracias de nuevo,

Debo admitir que esto me da el siguiente error en flash:

1180: Llamada a un método de StringReplace posiblemente no definido.

Lo sentimos, usted ha sido de gran ayuda, pero me parece ser una causa perdida!

ambiente

Nota Octubre 28th, 2009, 5:59 am

se le olvidó copiar el StringReplace función desde el primer código :)
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Nota Octubre 28th, 2009, 3:17 pm

Dios .. Im como un flash de aficionados.... funciona esto en el archivo flash ahora...publica multa.

Qué significa eso en el documento XML en lugar de <i> y </ i> Acabo de utilizar el paréntesis ()? Todavía no italicise.

Gracias de nuevo!

ambiente

Publicar Información

  • Total de mensajes en este tema: 11 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 125 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2010 Unmelted, LLC. Impulsado por phpBB © 2010 phpBB Group.