Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    1,037

    [ 2004 ] List, cellRenderer

    ciao a tutti!
    Ho un problema con questo script.
    Non so per quale motivo, inizia a lampeggiare( immagine non si vede piu per un attimo, il testo si sposta a sinistra,e poi l'immagine riappare) per l'evento rollOver e rollOut.
    codice:
    class MYCell extends mx.core.UIComponent
    {
    	var _text:TextField;
    	function MYCell()
    	{
    	}
    	function createChildren(Void):Void
    	{
    		if (_text == undefined)
    		{
    			createLabel("_text", 0);
    		}
    		_text.html = true;
    		_text.multiline = true;
    		_text.wordWrap = true;
    		_text.selectable = false;
    		_text.background = false;
    	}
    	function size(Void):Void
    	{
    		_text.setSize(__width, __height);
    	}
    	function setValue(str:String, node:Object, sel)
    	{
    		_text.htmlText = "[img]"+node.immagine+"[/img]  "+str;
    		size();
    	}
    	function getPreferredHeight()
    	{
    		return 100;
    	}
    	function getPreferredWidth()
    	{
    		return 20;
    	}
    }
    Non so per quale motivo faccia cosi :master:
    Avro' dimenticato qualcosa???
    grazie in anticipo

  2. #2
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Prova così:

    codice:
    	function setValue(str:String, node:Object, sel)
    	{
    		if(_text.htmlText == undefined)return;
    		_text.htmlText = "[img]"+node.immagine+"[/img]  "+str;
    		size();
    	}

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    1,037
    Purtroppo niente da fare, anche in quell caso lampeggia
    Ho provato anche creando un MovieClip, ma niente....
    codice:
    class MYCell extends mx.core.UIComponent
    {
    	var _text:TextField;
    	var image:MovieClip;
    	var listOwner:Object;
    	var $height:Number = 100;
    	function MYCell()
    	{
    	}
    	function createChildren(Void):Void
    	{
    		if (image == undefined)
    		{
    			createLabel("image", 2);
    		}
    		if (_text == undefined)
    		{
    			createLabel("_text", 1);
    		}
    		_text.html = true;
    		_text.multiline = true;
    		_text.wordWrap = true;
    		_text.selectable = false;
    		_text.background = false;
    	}
    	function size(Void):Void
    	{
    		_text._x = $height;
    		_text.setSize(__width, __height);
    	}
    	function setValue(str:String, node:Object, sel)
    	{
    		_text.htmlText = str;
    		if (node.immagine != undefined)
    		{
    			image.loadMovie(node.immagine);
    		}
    		size();
    	}
    	function getPreferredHeight()
    	{
    		return $height;
    	}
    	function getPreferredWidth()
    	{
    		return 20;
    	}
    }

  4. #4
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    1,037
    ok ho scoperto perchè, ricarica ogni volta che faccio rollOver e rollOut.
    Ho sostituito una parte con questo script:
    codice:
    	function size(Void):Void
    	{
    		_text._x = 0;
    		_text._y = 0;
    		_text.setSize(__width, __height);
    	}
    	function setValue(str:String, node:Object, sel)
    	{
    		trace(node.immagine);
    		if (node.immagine != undefined)
    		{
    			if (caricato == false)
    			{
    				_text.htmlText = "[img]"+node.immagine+"[/img]  "+str;
    				caricato = true;
    				size();
    			}
    		}
    	}
    pero inserendo cosi se pubblico, a onRollOver si spostano circa 2 pixel in su le immagini.
    Ho fatto un ciclo for, sulla cella, ma anziche restituirmi typeof movieclip, mi restituisce Object per image ???

  5. #5
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    >mi restituisce Object per image ???

    non ho capito..

  6. #6
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    1,037
    codice:
    	function createChildren(Void):Void
    	{
    		if (image == undefined)
    		{
    			createLabel("image", 2);
    		}
    		if (_text == undefined)
    		{
    			createLabel("_text", 1);
    		}
    		for (var a in this)
    		{
    			trace(a+'   '+typeof (this[a]));
    		}
    		trace('Se movieclip : '+(image instanceof MovieClip));
    ////////////////////////////////////////////
    nel trace:
    ..
    ..
    image object
    _text object
    Se movieclip : false

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.