JH0NNY 0 Denunciar post Postado Fevereiro 15, 2011 Boa Tarde a todos estou com um problema com um preloader e um menu. Seguinte se eu executar o código do menu, tudo funciona perfeitamente. Segue abaixo // Tab-Drop Multi Menu // author: fordlobster@dangerbeuys.de // http://dangerbeuys.de // Do whatever you want to do! import gs.TweenLite; import fl.motion.easing.*; var tabContainer:Sprite = new Sprite(); var tabArray:Array = new Array(); // Nomes dos botões var txtArray:Array = ["link 01", "link 02", "link 03", "link 04", "link 05"]; //paginas externas var urlArray:Array = ["arquivoexterno1.swf", "arquivoexterno2.swf", "arquivoexterno3.swf", "arquivoexterno4.swf", "arquivoexterno5.swf"]; //descrição das páginas var descArray:Array = ["Descrição do Link 01", "Descrição do Link 02", "Descrição do Link 03", "Descrição do Link 04", "Descrição do Link 05"]; // Numeros de Tabs var tabcount:int = 5; // How much space between buttons var tabspacing:int = 10; // Cores das Tabs var baseColor:uint = 0x000000; var overColor:uint = 0xCC6600; var activeColor:uint = 0x99CC00; //Posição da descrição var desctxt:Desctxt = new Desctxt(); desctxt.x = stage.stageWidth - (desctxt.width + tabspacing); desctxt.y = 75; desctxt.alpha = 0; addChild (desctxt); function initTab ():void { for (var i = 0; i < tabcount; i++) { var tab:Tab = new Tab(); TweenLite.to (tab.body, 0, {tint: baseColor}); tabArray.push (tab); tabArray[i].linkId = i; // Tabs x - Position tab.x = tabspacing * .5 + (stage.stageWidth - tabcount * (tab.width + tabspacing)) * .5 + Math.floor( i / 1 ) * (tab.width + tabspacing); // Tabs initial y - Position tab.y = 65; tab.txt.text = txtArray[i]; tab.addEventListener (MouseEvent.MOUSE_OUT, tabOut); tab.addEventListener (MouseEvent.MOUSE_OVER, tabOver); tab.buttonMode = true; tab.mouseChildren = false; tabContainer.addChild (tab); } addChild (tabContainer); } function tabOver (event:MouseEvent):void { var target:Object = event.currentTarget; target.addEventListener (MouseEvent.MOUSE_UP, tabUp); if (target.activa != 1) { TweenLite.to (target.body, .2, {tint: overColor}); TweenLite.to (target, .8, {y: 90, ease: Elastic.easeOut}); } desctxt.desc.text = descArray[target.linkId]; TweenLite.to (desctxt, .8, {alpha:1}); } function tabOut (event:MouseEvent):void { var target:Object = event.currentTarget; target.removeEventListener (MouseEvent.MOUSE_UP, tabUp); TweenLite.to (target.body, 1.5, {tint: baseColor}); TweenLite.to (target, 1, {y: 65, ease: Back.easeInOut}); TweenLite.to (desctxt, 1, {alpha:0}); } function tabUp (event:MouseEvent):void { var target:Object = event.currentTarget; for (var i in tabArray) { if (tabArray[i] != target) { tabArray[i].activa = 0; tabArray[i].addEventListener (MouseEvent.MOUSE_OVER, tabOver); tabArray[i].addEventListener (MouseEvent.MOUSE_OUT, tabOut); TweenLite.to (tabArray[i].body, 1.5, {tint: baseColor}); TweenLite.to (tabArray[i], 1, {y: 65, ease: Back.easeInOut}); } else { tabArray[i].activa = 1; tabArray[i].removeEventListener (MouseEvent.MOUSE_OUT, tabOut); TweenLite.to (tabArray[i].body, .3, {tint: activeColor}); MeuLoad.load(new URLRequest(urlArray[tabArray[i].linkId]));// Chama as páginas externas } } } initTab (); // Loader pra carregar as paginas externas var MeuLoad:Loader = new Loader(); // Aqui carrega a página principal MeuLoad.load(new URLRequest("arquivoexterno.swf")); // hold = MC vazio no palco hold.addChild(MeuLoad); Dai pensei em implementar um preloader pra mostrar o carregamento dessas páginas externas, pesquisei e encontrei algo sobre o assunto. Fiz a alteração no código e começou a dar erro. 1120: Access of undefined property MeuLoad MeuLoad.load(new URLRequest(urlArray[tabArray.linkId])) Abaixo o código com o Loader function startLoad(){ var MeuLoad:Loader = new Loader(); MeuLoad.load(new URLRequest("arquivoexterno.swf")); MeuLoad.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler); hold.addChild(MeuLoad); } function onProgressHandler(mProgress:ProgressEvent) { var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal; percent = Math.round(percent*100); porcento.text = percent+" %"; } startLoad(); Se eu removo a linha MeuLoad.load(new URLRequest(urlArray[tabArray.linkId])) que é a que chama as páginas externas, o Loader funciona normalmente, mostrando o carregamento e após a página externa, mas o menu para de funcionar.Já pesquisei e tentei várias coisas mas nada resolveu. Por isso peço ajuda aqui no fórum. Obrigado pela atenção Compartilhar este post Link para o post Compartilhar em outros sites
JH0NNY 0 Denunciar post Postado Fevereiro 16, 2011 Consegui resolver. Pra quem tiver o mesmo problema segue o código Valeu a todos // Tab-Drop Multi Menu // author: fordlobster@dangerbeuys.de // http://dangerbeuys.de // Do whatever you want to do! //Menu encontrado no site: http://www.ffiles.com/flash/menus/multi_tab_drop_menu_1850.html import gs.TweenLite; import fl.motion.easing.*; var tabContainer:Sprite = new Sprite(); var tabArray:Array = new Array(); // Nomes dos botões var txtArray:Array = ["link 01", "link 02", "link 03", "link 04", "link 05"]; //paginas externas var urlArray:Array = ["arquivoexterno1.swf", "arquivoexterno2.swf", "arquivoexterno3.swf", "arquivoexterno4.swf", "arquivoexterno5.swf"]; //descrição das páginas var descArray:Array = ["Descrição do Link 01", "Descrição do Link 02", "Descrição do Link 03", "Descrição do Link 04", "Descrição do Link 05"]; // Numeros de Tabs var tabcount:int = 5; // How much space between buttons var tabspacing:int = 10; // Cores das Tabs var baseColor:uint = 0x000000; var overColor:uint = 0xCC6600; var activeColor:uint = 0x99CC00; //Posição da descrição var desctxt:Desctxt = new Desctxt(); desctxt.x = stage.stageWidth - (desctxt.width + tabspacing); desctxt.y = 75; desctxt.alpha = 0; addChild (desctxt); function initTab ():void { for (var i = 0; i < tabcount; i++) { var tab:Tab = new Tab(); TweenLite.to (tab.body, 0, {tint: baseColor}); tabArray.push (tab); tabArray[i].linkId = i; // Tabs x - Position tab.x = tabspacing * .5 + (stage.stageWidth - tabcount * (tab.width + tabspacing)) * .5 + Math.floor( i / 1 ) * (tab.width + tabspacing); // Tabs initial y - Position tab.y = 65; tab.txt.text = txtArray[i]; tab.addEventListener (MouseEvent.MOUSE_OUT, tabOut); tab.addEventListener (MouseEvent.MOUSE_OVER, tabOver); tab.buttonMode = true; tab.mouseChildren = false; tabContainer.addChild (tab); } addChild (tabContainer); } function tabOver (event:MouseEvent):void { var target:Object = event.currentTarget; target.addEventListener (MouseEvent.MOUSE_UP, tabUp); if (target.activa != 1) { TweenLite.to (target.body, .2, {tint: overColor}); TweenLite.to (target, .8, {y: 90, ease: Elastic.easeOut}); } desctxt.desc.text = descArray[target.linkId]; TweenLite.to (desctxt, .8, {alpha:1}); } function tabOut (event:MouseEvent):void { var target:Object = event.currentTarget; target.removeEventListener (MouseEvent.MOUSE_UP, tabUp); TweenLite.to (target.body, 1.5, {tint: baseColor}); TweenLite.to (target, 1, {y: 65, ease: Back.easeInOut}); TweenLite.to (desctxt, 1, {alpha:0}); } function tabUp (event:MouseEvent):void { var target:Object = event.currentTarget; for (var i in tabArray) { if (tabArray[i] != target) { tabArray[i].activa = 0; tabArray[i].addEventListener (MouseEvent.MOUSE_OVER, tabOver); tabArray[i].addEventListener (MouseEvent.MOUSE_OUT, tabOut); TweenLite.to (tabArray[i].body, 1.5, {tint: baseColor}); TweenLite.to (tabArray[i], 1, {y: 65, ease: Back.easeInOut}); } else { tabArray[i].activa = 1; tabArray[i].removeEventListener (MouseEvent.MOUSE_OUT, tabOut); TweenLite.to (tabArray[i].body, .3, {tint: activeColor}); MeuLoad.load(new URLRequest(urlArray[tabArray[i].linkId]));// Chama as páginas externas } } } initTab (); var MeuLoad:Loader = new Loader(); MeuLoad.load(new URLRequest("arquivoexterno.swf")); MeuLoad.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop); MeuLoad.contentLoaderInfo.addEventListener(Event.COMPLETE, done); hold.addChild(MeuLoad); function loop(e:ProgressEvent):void { var perc:Number = e.bytesLoaded / e.bytesTotal; percent.text = Math.ceil(perc*100).toString(); Bar.scaleX = perc; } function done(e:Event):void { percent.text = ""; } Compartilhar este post Link para o post Compartilhar em outros sites