Visualizzazione dei risultati da 1 a 8 su 8

Discussione: problema testo menu

  1. #1
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560

    problema testo menu

    Ho questo menu in flash: http://www.sitowebflash.com/caccavelli/Flash_Menu.swf

    Dovrei mettere il testo del secondo pulsante "linea libero servizio formato famiglia" su due righe, così:

    linea libero servizio
    formato famiglia

    ho provato mettendo un
    tra una parola e l'altra ma non funziona.
    Come posso risolvere? grazie

    questo menu funziona con il file menu.xml:




    codice:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <menu type="Flash Menu Labs Open Source Edition  (Vertical)  www.flashmenulabs.com" >
    
    
    	<spec_menu_params
    		is_physic_enabled = "1"					
    		webmaster_text = "Smaple webmaster text"
    		webmaster_url = "http://flashmenulabs.com"
    		
    		
    		enable_soft_wave_when_appear = "1"	comment = "to use this effect you should set is_physic_enabled = 1 "
    		
    		
    		base_shift_x = "20"		comment = "basic shift of the menu X"
    		base_shift_y = "0"		comment = "basic shift of the menu Y"
    					
    	
    					
    		appear_effect_pos_type = "0"		comment = " Position Effect when appearing; 0 - no pos effect; 1 - from random pos; 2 - from sides"
    		disappear_effect_pos_type = "0"		comment = " Position Effect when disappearing"
    
    		appear_effect_opacity_type ="1"	comment = "Opacity Effect when appearing; 0 - no opacity effect;1 - simple fade in; 2 - luminiscent lamp"
    		disappear_effect_opacity_type = "1"	comment = "Opacity Effect when disappearing"
    
    			
    
    		flex_coef = "5.9"		comment = "Physics, flexibility coef" 
    		decay_coef = "1.25"	comment = "Physics, decay coef" 
    		random_coef = "0.0"	comment = "Physics, coef of randomnes of physic parameters" 
    	/>
    
    	<app_disapp_eff>
    		
    		<eff_pos 
    			max_time_to_wait = "0" 
    			accel_coef = "5" 
    			base_speed = "100"
    			jump_coef = "0.33"
    			even_odd_side_dist = "71"
    		/>
    		
    		<eff_opacity 
    			max_time_to_wait = "0"
    			time_to_appear = "2.1"	
    			time_to_disappear ="2.1"		
    		/>
    	</app_disapp_eff>
    
    
    	
    	<level 
    		numb= "0" 					comment = "for root menu level"
    		fixed_menu_width = "120"	  comment = "minimum width of menu item. Setting to -1 make it autosized  "	
    		menu_height_coef = "1.2"		comment = "the resulting menu height will be text height multiplyed by this coef"
    		dist_between_menu_items_x = "0"
    		dist_between_menu_items_y = "1"	
    	>		
    		<font	
    			comment = " font parameters in 3 states normal, mouseover,selected"
    			size = "12"
    
    			underline_normal = "0"
    			underline_mouseover = "1"
    			underline_selected = "1"
    
    			bold_normal = "0"
    			bold_mouseover = "0"
    			bold_selected = "0"
     
    			color_normal =    "0xFFFFFF"
    			color_mouseover = "0xFFFFFF"
    			color_selected =  "0xFFFFFF"
    		/>
    		<place_dist
    			border_dist = "10"		comment = "distance between menu item left border and text"
    		/>
    		
    	</level>
    
    	<level 
    		numb= "1"	comment = "for all menu sublevels"
    
    		fixed_menu_width = "10"		comment = "minimum width of menu item. Setting to -1 make it autosized  "		
    		menu_height_coef = "1.1"	comment = "the resulting menu height will be text height multiplyed by this coef"
    		dist_between_menu_items_x = "2"
    		dist_between_menu_items_y = "1"
    	>		
    		<font
    			comment = " font parameters in 3 states normal, mouseover,selected"
    			size = "11"
    
    			underline_normal = "0"
    			underline_mouseover = "1"
    			underline_selected = "1"
    
    			bold_normal = "1"
    			bold_mouseover = "1"
    			bold_selected = "1"			
    			
    			color_normal =    "0x424242"
    			color_mouseover = "0xEEEEEE"
    			color_selected =  "0xEEEEEE" 
    		/>
    		<place_dist
    			border_dist = "10"		comment = "distance between menu item left border and text"
    		/>
    	</level>
    
    	
    	<menu_structure>
    	
    		<item>
    			<item text = "linea libero servizio" url = "" url_self = "1">
    			</item>
    			<item text = "linea libero servizio formato famiglia" url = "" url_self = "1" >
    				<item text = "Overview" url = "" url_self = "0" />
    				<item text = "History" url = "" url_self = "1" />
    				<item text = "Team" url = "" url_self = "1" />
    				<item text = "Partners" url = "" url_self = "1" />
    				<item text = "Career" url = "" url_self = "1" />
    			</item>
    			<item text = "linea derivati" url = "" url_self = "1"  >
    				<item text = "Multi-device" url = "" url_self = "1" />
    				<item text = "Monitoring" url = "" url_self = "1" >
    					<item text = "Temperature" url = "" url_self = "1" />
    					<item text = "Humidity" url = ""  url_self = "1"/>
    					<item text = "Acceleration" url = ""  url_self = "1"/>
    					<item text = "Wind Speed" url = ""  url_self = "1"/>
    					<item text = "Light Detectors" url = ""  url_self = "1"/>
    
    
    
    				</item>
    				<item text = "Nanotechnology" url = "" url_self = "1" />
    				<item text = "Solar Energy" url = "" url_self = "1" />
    				<item text = "Electric Cars" url = "" url_self = "1" />
    				<item text = "Electric Scooters" url = "" url_self = "1" />
    
    
    
    			</item>
    			<item text = "Products" url = "" url_self = "1" >
    				<item text = "Eagle-M" url = "" url_self = "1" />
    				<item text = "Eagle-2M" url = "" url_self = "1" />
    				<item text = "Controllers" url = "" url_self = "1" />
    			</item>
    			<item text = "Support" url = "" url_self = "1" >
    			</item>
    			<item text = "Contact" url = ""  url_self = "1" >
    			</item>
    		</item>
    		
    	</menu_structure>
    
    </menu>

  2. #2
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    puoi provare a scrivere la riga così:

    "linea libero servizio \n formato famiglia"

    ma bisogna vedere se il codice ne tiene conto


  3. #3
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    grazie per il consiglio ma non funziona..

    dovrei provare a spittare con il bbcode vero?

    tipo: stringa = stringa.split("[br]").join("
    ");

    e poi nel codice xml: <item text = "linea libero servizio[br]formato famiglia" url = "" url_self = "1" >

    però non so dove inserire la riga nel codice in flash, mi dai una mano:

    codice:
    var GLB_data:CMenuVertClassicGlobalData = new CMenuVertClassicGlobalData();
    GLB_data.m_local_root = this;
    var m_xml:XML = new XML();
    m_xml.ignoreWhite = true;
    
    m_xml.onLoad = function(success) 
    {
    	if (success) 
    	{		
    
    		var xml_reader:CMenuVertClassicXMLReader = new CMenuVertClassicXMLReader(GLB_data);	
    		xml_reader.ReadXML(m_xml);		
    		var root_node = xml_reader.GetFirstMenuRootNode(m_xml);
    		
    		var rootGroup = new CMenuVertClassic(0, 0, "menu", 0,null,GLB_data);
    		rootGroup.BrowseSubMenu(root_node, 0, null);
    		rootGroup.UnselectAndArrange();
    		GLB_data.m_local_root.m_root_group = rootGroup;		
    	}
    };
    
    m_xml.load("menu.xml");
    
    //
    this.menuItem_mc._visible = false;
    onEnterFrame = function () {
    	GLB_data.m_local_root.m_root_group.ProcessState(0.1);
    };
    grazie

  4. #4
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    quel codice è solo la parte finale di visualizzazione dell'intero menù che è gestito dalle classi
    immagino comunque che non sia possibile mandare accapo il field se non cambiando il codice della classe che gestisce gli items

  5. #5
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    ho capito...mi sa che questo è il codice che gestisce gli items:
    e dove cambio il codice?

    codice:
    import flash.geom.*;
    import flash.display.*;
    
    class CMenuItem extends MovieClip 
    {
    	var m_bg_clip:MovieClip;					// bacgroun clip
    	var m_text_field:TextField;					// text field
    	var m_arrow_clip:MovieClip;					// arrow that shows that there are some children items
    	var m_url:String;							// url
    	var m_url_self:Boolean;						// url_self parameter
    	var m_fixed_width:Number;					// fixed menu width
    	
    	var m_curr_visual_state:Number;				// current visua state
    	
    	var m_is_under_mouse:Boolean;				// is item under mouse
    	var GLB_data:CMenuVertClassicGlobalData;
    	var m_clip_number:Number;					// number of item in parent m_clip_ar array
    	var m_parent_group:CMenuVertClassic;		// pointer to the parent group
    	var m_border_dist:Number;					// distance from left border to the text area
    		
    //---------------------------------------------------------------------------------------------
    	function CMenuItem()
    	{		
    		m_clip_number = -1;
    		m_parent_group = null;
    		m_arrow_clip = null;
    		m_is_under_mouse = false;		
    		m_curr_visual_state = -1;
    		m_url = "";
    		m_url_self = true;
    		m_border_dist = 10;
    		m_fixed_width = -1;
    	} 	
    //---------------------------------------------------------------------------------------------
    	function Init(parent:CMenuVertClassic, children_number:Number, clip_numb:Number)
    	{
    		m_parent_group = parent;
    		m_clip_number = clip_numb;
    		GLB_data = parent.GLB_data;
    		
    		
    		var index = 0;
    		if(m_parent_group.m_level>0) index = 1;
    		var level_data = GLB_data.m_level_data_ar[index];
    		
    		m_fixed_width = level_data.m_fixed_menu_width ;
    		
    		// m_bg_clip
    		m_bg_clip = attachMovie("templ_lev0_normal","bg_clip",getNextHighestDepth());		
    		
    				
    		// m_text_field								
    		createTextField("m_text_field", getNextHighestDepth(), 0, 0, 0, 0 );		
    
    		//m_arrow_clip
    		if(children_number>0)
    		{
    			m_arrow_clip = attachMovie("templ_lev0_arrow","arrow",getNextHighestDepth());		
    		}
    				
    		
    		m_text_field.border = false;
    		var text_fmt:TextFormat = m_text_field.getTextFormat();		
    		m_text_field.embedFonts = false;
    		text_fmt.font = "Arial";
    		text_fmt.bold = level_data.m_font_bold_normal;
    		text_fmt.size = level_data.m_font_size;		
    			
    		m_text_field.autoSize = true;
    		m_text_field.setNewTextFormat(text_fmt);	
    		
    		
    		
    	}
    		
    //---------------------------------------------------------------------------------------------
    	function SetText(str:String):Void
    	{		
    		if(str == "") str = " ";
    		m_text_field.text = str;		
    	}	
    //---------------------------------------------------------------------------------------------
    	function SetPos(pos:CVector2D):Void
    	{
    		SetPosXY(pos.x,pos.y);
    	}
    //---------------------------------------------------------------------------------------------
    	function SetPosXY(ax:Number,ay:Number):Void
    	{
    		_x = ax;
    		_y = ay;		
    	}
    //---------------------------------------------------------------------------------------------
    	function FitBackgroundSize():Void
    	{		
    		var index = 0;
    		if(m_parent_group.m_level>0) index = 1;
    		var level_data = GLB_data.m_level_data_ar[index];
    
    		var own_w = m_text_field._width + m_border_dist*3;
    		if(m_arrow_clip != null)		
    		{
    			own_w  += m_arrow_clip._width;			
    		}
    
    		
    		var w = own_w;
    		if(m_fixed_width>-1)
    		{
    			if(m_fixed_width>own_w)
    			{
    				w = m_fixed_width;
    			}
    			else
    			{
    				w = own_w;
    			}
    		}
    		else
    		{
    			w = own_w;
    		}
    		m_bg_clip._width = w;
    		
    		var h = m_text_field._height*level_data.m_menu_height_coef;
    		m_bg_clip._height = h;
    		
    
    	}
    //---------------------------------------------------------------------------------------------
    	//set correct inner clips positions
    	function SetProperClipsPos():Void
    	{
    		m_text_field._x = m_border_dist;
    		m_text_field._y = (_height - m_text_field._height)/2;
    		
    		if(m_arrow_clip != null)
    		{			
    			m_arrow_clip._x = _width - m_arrow_clip._width - m_border_dist;
    			m_arrow_clip._y = (_height - m_arrow_clip._height)/2;
    		}
    
    	}
    //---------------------------------------------------------------------------------------------
    	
    //---------------------------------------------------------------------------------------------
    	// set visual state for this item 
    	// these state are declared in CMenuVertClassic.as file
    	// var visual_state_none = -1;						
    	// var visual_state_normal = 0;						
    	// var visual_state_mouseover = 1;					
    	// var visual_state_selected = 2;		
    	function SetCurrVisualState(vis_state:Number)
    	{
    		if(vis_state == m_curr_visual_state) return ;
    		m_curr_visual_state = vis_state;
    		
    		
    		var templ_str:String = m_parent_group.GetTemplClipName(vis_state);
    		var name_str:String = m_bg_clip._name;
    		var depth:Number = m_bg_clip.getDepth();		
    		//m_bg_clip.attachMovie(templ_str,name_str,depth);		
    		m_bg_clip.removeMovieClip();
    		m_bg_clip = attachMovie(templ_str,name_str,depth);		
    		m_bg_clip.gotoAndPlay(1);
    		
    		
    		FitBackgroundSize();
    		
    		
    		var index = 0;
    		if(m_parent_group.m_level>0) index = 1;
    		var level_data = GLB_data.m_level_data_ar[index];
    		
    		
    		var text_fmt:TextFormat = m_text_field.getTextFormat();				
    		
    		switch(vis_state)
    		{
    			case m_parent_group.visual_state_normal:
    				text_fmt.color = level_data.m_font_color_normal;						
    				text_fmt.underline = level_data.m_font_underline_normal;
    				text_fmt.bold = level_data.m_font_bold_normal;
    			break;
    			case m_parent_group.visual_state_mouseover:
    				text_fmt.color = level_data.m_font_color_mouseover;
    				text_fmt.underline = level_data.m_font_underline_mouseover;
    				text_fmt.bold = level_data.m_font_bold_mouseover;
    				
    			break;
    			case m_parent_group.visual_state_selected:
    				text_fmt.color = level_data.m_font_color_selected;
    				text_fmt.underline = level_data.m_font_underline_selected;	
    				text_fmt.bold = level_data.m_font_bold_selected;
    			break;
    		}
    		m_text_field.setTextFormat(text_fmt);
    		
    		
    	}
    //---------------------------------------------------------------------------------------------
    	function onRollOut(): Void 
    	{		
    		m_is_under_mouse = false;				
    	}
    //---------------------------------------------------------------------------------------------
    	function onRollOver(): Void 
    	{	
    		
    		m_is_under_mouse = true;
    		
    	}
    //---------------------------------------------------------------------------------------------	
    	function onPress()
    	{
    		if(m_url.length == 0) 
    		{
    			trace(" No url");
    			return;
    		}	
    		if(_root.m_remote_control_mc != null)
    		{
    			//GLB_data.RealTrace("_root.m_remote_control_mc != null");
    			var frame_number = Number(m_url);
    			//_root.m_remote_control_mc.gotoAndPlay(frame_number);
    			_root.m_remote_control_mc.gotoAndStop(frame_number);
    		}
    		else
    		{
    			//GLB_data.RealTrace("_root.m_remote_control_mc == null");
    			if(m_url_self)
    			{
    				getURL(m_url,"_self");
    			}
    			else
    			{
    				getURL(m_url,"_blank");
    			}
    		}
    			
    	}
    //---------------------------------------------------------------------------------------------	
    	function onEnterFrame(): Void 
    	{	
    		
    		if(m_is_under_mouse)
    		{			
    			GLB_data.m_mouse_out_count = 0;			
    			m_parent_group.DoSelect(m_clip_number);			
    		}
    		else
    		{
    			// only one button should control the timer
    			if(m_parent_group.m_level == 0 && m_clip_number == 1)
    			{	
    				if(GLB_data.m_mouse_out_count<GLB_data.m_mouse_out_delay)
    				{
    					GLB_data.m_mouse_out_count++;					
    					if(GLB_data.m_mouse_out_count == GLB_data.m_mouse_out_delay ) 
    					{						
    						m_parent_group.SetState(m_parent_group.state_waiting_children_disappear);
    					}
    				}
    			}				
    		}
    	}	
    //---------------------------------------------------------------------------------------------
    	function SetAlpha(alpha:Number):Void
    	{
    		_alpha  = alpha;		
    	}
    //---------------------------------------------------------------------------------------------		
    }// end of class

  6. #6
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    ci vuole un po' troppo tempo ad analizzare e modificare quel codice, considera che se non era stato previsto, è molto probabile che sia necessario rifare i calcoli per i posizionamenti e il ridisegno dei singoli pulsanti
    purtroppo non ho proprio il tempo di stare a verificare tutto quel codice

  7. #7
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    sto provando diversi menu...non ne trovo uno che fa al caso mio..
    saresti così gentile da postarmi un link dove sono dei menu simili a questo?
    semplici in flash... che passando su una voce si apre a destra il sottomenu e così via...

    sto impazzendo

  8. #8
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    ho trovato un altro menu più semplice:

    codice:
    GenerateMenu = function(container, menuname, x, y, depth, xml_element) {
    	// Initialisierung
    	var akt_element;
    	var akt_eintrag;
    	var akt_menu = container.createEmptyMovieClip(menuname, depth);
    	
    	// Sämtliche Einträge erfassen
    	for (var i=0; i<xml_element.childNodes.length; i++) {
    		
    		// MovieClip für jeden Eintrag erzeugen
    		akt_eintrag = akt_menu.attachMovie("menueintrag","eintrag"+i+"_mc", i);
    		akt_eintrag._x = x;
    		akt_eintrag._y = y + i*akt_eintrag._height;
    		akt_eintrag.trackAsMenu = true;
    		
    		// Menüeintrags Eigenschaften anhand der XML Zuweisung festlegen
    		akt_element = xml_element.childNodes[i];
    		akt_eintrag.aktion = akt_element.attributes.aktion;
    		akt_eintrag.variables = akt_element.attributes.variables;
    		akt_eintrag.menuname.text = akt_element.attributes.name;
    		
    		// Untermenü Eintrag Verhalten für Rollover Ereignis festlegen
    		if (xml_element.childNodes[i].nodeName == "menu"){
    			// Untermenü Öffnen (durch Rekursiven Aufruf)
    			akt_eintrag.xml_element = akt_element;
    			akt_eintrag.onRollOver = akt_eintrag.onDragOver = function(){
    				clearInterval(timeout_iv);
    				var x = this._x + this._width;
    				var y = this._y;				
    				GenerateMenu(akt_menu, "submenu_mc", x, y, 1000, this.xml_element);
    				// Drüber Zustand (Färben)
    				var col = new Color(this.hintergrund);
    				col.setTransform({ra:50,rb:70,ga:50,gb:70,ba:50,bb:70});				
    			};
    		}else{ // Elementname "eintrag"
    			akt_eintrag.pfeil._visible = false;
    			// Untermenü Schliessen
    			akt_eintrag.onRollOver = akt_eintrag.onDragOver = function(){
    				clearInterval(timeout_iv);
    				akt_menu.submenu_mc.removeMovieClip();
    				// Drüber Zustand (Färben)
    				var col = new Color(this.hintergrund);
    				col.setTransform({ra:50,rb:70,ga:50,gb:70,ba:50,bb:70});				
    			};
    		}
    		
    		akt_eintrag.onRollOut = akt_eintrag.onDragOut = function(){
    			// Ursprüngliche Einfärbung wiederherstellen
    			var col = new Color(this.hintergrund);
    			col.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});			
    			// TimeOut (Aktiv oder Inaktiv) (ComboBox und Numericstepper)
    			if (timeout_cb.value) TimeOut (this, dauer_stepper.value*1000);
    		};
    		
    		// Mögliche Aktionen des jeweiligen Eintrags auslösen
    		akt_eintrag.onRelease = function(){
    			Aktionen[this.aktion](this.variables);
    			CloseSubmenus();
    		};
    	}
    };
    
    // Hauptmenü erzeugen
    CreateMainMenu = function(x, y, depth, menu_xml){
    	// Menüliste erzeugen
    	GenerateMenu(this, "mainmenu_mc", x, y, depth, menu_xml.firstChild);
    	// Untermenüs lediglich dann schliessen, wenn diese während
    	// eines MouseUp Ereignisses sichtbar waren	
    	mainmenu_mc.onMouseUp = function(){
    		if (mainmenu_mc.submenu_mc && !mainmenu_mc.hitTest(_root._xmouse, _root._ymouse, true)){
    			CloseSubmenus();
    		}
    	};
    };
    
    // Sämtliche Untermenüs entfernen, falls welche im Hauptmenü existieren
    CloseSubmenus = function(){
    	clearInterval(timeout_iv);
    	mainmenu_mc.submenu_mc.removeMovieClip();
    };
    
    // Setzt ein Timeout um die Untermenüs nach einer festgelegten
    // Zeit wieder zu schließen.
    TimeOut = function (ziel, dauer) {	
    	function setzeOut() {
    		if (!ziel.hitTest()) {		
    			CloseSubmenus();
    			clearInterval (timeout_iv);
    		}
    	}
    	this.timeout_iv = setInterval(setzeOut, dauer);
    }
    
    // Objekt verwaltet die Aktionen die den jeweiligen Einträgen 
    // innerhalb der XML-Struktur zugewiesen wurden.
    Aktionen = new Object();
    Aktionen.message = function(msg){
    	ausgabe_txt.text = msg;
    };
    Aktionen.gotoURL = function(urlVar){
    	getURL(urlVar, "_blank");
    };
    Aktionen.newMenu = function(menuxml){
    	menu_xml.load(menuxml);
    };
    
    // XML-Laden und anschliessend Hauptmenü ausführen
    menu_xml = new XML();
    menu_xml.ignoreWhite = true;
    menu_xml.onLoad = function(status){	
    	if (status){
    		CreateMainMenu(10, 10, 0, this);
    		ausgabe_txt.text = "Daten geladen...";		
    	}else{
    		ausgabe_txt.text = "Fehler:  Daten konnten nicht geladen werden!";
    	}
    };
    // Erstes Menü laden
    menu_xml.load("menu1.xml");
    questo si può modificare per far andare il testo del menu a capo?

    un pezzo iniziale del file menu1.xml:

    codice:
    <?xml version="1.0"?>
    <menu name="beispiel">
    	<eintrag name="Beispiel" aktion="message" variables="Hier ein Beispiel Text..."/>
    	<menu name="Untermenü">
    		<menu name="Untermenü">
    			<eintrag name="Eintrag"/>
    			<eintrag name="Eintrag"/>
    			<eintrag name="Eintrag"/>
    		</menu>

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 © 2026 vBulletin Solutions, Inc. All rights reserved.