Poxa pessoal, nada?
Não sei mais o que fazer pra solucionar. Não rola "fazer na mão" a parte que com XML fica certinho.
Help !
- Fórum WMO
- → J. Silvério's Content
J. Silvério's Content
There have been 3 items by J. Silvério (Search limited from 12/05/2023)
Ordernar por
Order
#994445 Swf Externo Não Carrega Xml
Posted by J. Silvério on 15/02/2010, 00:22 in Adobe Flash e ActionScript
#994261 Swf Externo Não Carrega Xml
Posted by J. Silvério on 12/02/2010, 00:21 in Adobe Flash e ActionScript
Olá pessoal,
Já procurei no google, aqui no fórum e em outros também.
Tem a base do site que se chama index.swf. Essa base carrega um sistema de notícias (news.swf) que por sua vez lê os dados em um XML.
Se eu abro a news.swf separadamente ele lê normalmente. Se eu abro o index.swf fica em "loading".
Estou chamando na index.swf a news.swf por um loadMovie. Na news.swf só tem 2 códigos que estão no 1º frame da 2ª linha.
Cod 1 - #include "mc_tween2.as"
Cod 2 - var ticker = new Ticker();
Já adiantando, os apontamentos com relação a leitura de AS e XML estão certos.
Segue o código Ticker.as:
Não sei se é problema de _root que tá fazendo isso. A news.swf não é lida na raiz do index.swf, ela é lida 3 níveis acima. Dentro do index.swf temos:
Scene > mcMain > itens > news (aqui aparece o código loadMovie)
Ufaaaa...
Alguém pode me dar uma luz?
Vi algo parecido no fórum mas já mexi várias vezes e não consegui resolver, preciso da ajuda de programador mais avançado.
Obrigado pela atenção.
Abs!
Já procurei no google, aqui no fórum e em outros também.
Tem a base do site que se chama index.swf. Essa base carrega um sistema de notícias (news.swf) que por sua vez lê os dados em um XML.
Se eu abro a news.swf separadamente ele lê normalmente. Se eu abro o index.swf fica em "loading".
Estou chamando na index.swf a news.swf por um loadMovie. Na news.swf só tem 2 códigos que estão no 1º frame da 2ª linha.
Cod 1 - #include "mc_tween2.as"
Cod 2 - var ticker = new Ticker();
Já adiantando, os apontamentos com relação a leitura de AS e XML estão certos.
Segue o código Ticker.as:
class Ticker { private var news:Array = new Array(); //the array which stores objects containing text,date,time,link tags from each item in XML file private var XMLFile:String="news.xml"; //the name of the XML file private var currentMessage=-1; //the current possition in the news array (current displayed headline) private var interval=-1; //inverval variable used in function rotateNews to change headlines private var interval2=-1; //inverval variable used in function rotateNews to change headlines private var textColor:Number; //text color from xml file private var overColor:Number; //over state text color from xml file private var arrowPress:Boolean=false; public var maxCharCount:Number=-1; //max char count from XML file public var newsTimer; //delay for each headline from XML files static var instance:Ticker; //this class //constructor function Ticker() { instance=this; //i am me <img src='http://forum.wmonline.com.br/public/style_emoticons/default/smile.gif' class='bbc_emoticon' alt=':)' /> trace("- ticker started"); init(); //in the constructor function we don't have access to all stage members } //do intializations function init(){ // align stage to top left corner Stage.align = "TL"; // set scale mode to no scale Stage.scaleMode = "noScale"; // create a listener object for the stage var stageListener = new Object(); // this function will be triggered every time the window is resized function rearrange() { var w:Number = Stage.width, h:Number = Stage.height; // rearange objects on stage _root.news_text.txt.autoSize=true; //_root.news_back._width=w; //_root.news_back._y=h-_root.news_back._height; _root.news_count._y=h-_root.news_count._height-12; _root.news_count._x=w-_root.news_count._width-37; _root.news_dateTime._y=h-_root.news_dateTime._height-4; _root.news_dateTime._x=_root.a2._x; //_root.grad_right._x=w-_root.grad_right._width; //_root.grad_right._y=h-_root.grad_right._height-2; _root.news_text._y=h-_root.news_text._height-3; //_root.grad_left._y=h-_root.grad_left._height-0.1; //_root.grad_up._x=_root.a1._x; _root.grad_up._y=h-26.2; _root.grad_up._width=w-_root.a1._width; _root.news._x=_root.a1._x; } stageListener.onResize = rearrange; // add stage listener Stage.addListener(stageListener); // arange objects on stage rearrange(); //parse the XML file XMLRead(XMLFile); //assign event handler for text field _root.news_text.onRollOver = instance.newsOnRollOver; _root.news_text.onRollOut = _root.news_text.onReleaseOutside = instance.newsOnRollOut; _root.news_text.onRelease = instance.newsOnRelease; } // this function reads the xml and saves the news to news array function XMLRead(fileName) { var xml:XML= new XML; xml.ignoreWhite=true; xml.onLoad = function (success:Boolean) { //_root.news_text._y=301; if (success) { trace("-XML file: "+fileName+" successfully loaded."); var mainNode:XMLNode=xml.firstChild.firstChild.firstChild; //this will pars "main" node of the XML file while (mainNode!=null) { mainNode.nodeName.toLowerCase()=="maxcharcount"?instance.maxCharCount=Number(mainNode.firstChild.toString()):false; mainNode.nodeName.toLowerCase()=="newstimer"?instance.newsTimer=Number(mainNode.firstChild.toString()):false; mainNode.nodeName.toLowerCase()=="textcolor"?instance.textColor=Number(mainNode.firstChild.toString()):false; mainNode.nodeName.toLowerCase()=="overcolor"?instance.overColor=Number(mainNode.firstChild.toString()):false; mainNode=mainNode.nextSibling; } var itemsNode:XMLNode=xml.firstChild.firstChild.nextSibling.firstChild; //this will pars "items" node of the XML file while (itemsNode!=null) { mainNode=itemsNode.firstChild; var news_object:Object = new Object(); //creates an object //this will pars "item" node of the XML file while (mainNode!=null) { mainNode.nodeName.toLowerCase()=="text"?news_object.text=mainNode.firstChild.toString():false; mainNode.nodeName.toLowerCase()=="date"?news_object.date=mainNode.firstChild.toString():false; mainNode.nodeName.toLowerCase()=="time"?news_object.time=mainNode.firstChild.toString():false; mainNode.nodeName.toLowerCase()=="link"?news_object.link=mainNode.firstChild.toString():false; mainNode.nodeName.toLowerCase()=="window"?news_object.window=mainNode.firstChild.toString():false; mainNode=mainNode.nextSibling; } instance.news.push(news_object); //push the object into news array itemsNode=itemsNode.nextSibling; } /* --------------- DEBUG -------------- for (var i=0; i<instance.news.length; i++) { for (var name in instance.news[i]) { trace("-->" +name+" = "+instance.news[i][name]); } } ------------------------------------ */ //set textColor to headline var txt_fmt:TextFormat = new TextFormat(); txt_fmt.color = instance.textColor; _root.news_text.txt.setTextFormat(txt_fmt); //start to change news instance.changeNews(true); } else { trace("Unable to load XML file: "+fileName); } } //load xml file xml.load(fileName); } //trim displayed text to macCharCount read from XML file function trimToMaxCharCount(txt:String) : String { if (txt.length>instance.maxCharCount) { return txt.slice(0,instance.maxCharCount-3)+"..."; } else { return txt; } } //change news function changeNews(ascending:Boolean) { //clear all previus intervals that may be active to avoid overlap clearInterval(instance.interval); clearInterval(instance.interval2); //adjust message counter ascending?instance.currentMessage++:instance.currentMessage--; if (instance.currentMessage<0) { instance.currentMessage=instance.news.length-1; } if (instance.currentMessage>=instance.news.length) { instance.currentMessage=0; } //wipe current headline <--- <--- ---> ---> //<MovieClip|Sound|TextField>.tween(property(ies), ending value(s) [, seconds, animation type, delay, callback, extra1, extra2]); _root.news_dateTime.tween("_y",Stage.height,0.5); _root.news_text.tween("_y",Stage.height-28-_root.news_text._height,1); instance.interval2 = setInterval(function() { clearInterval(instance.interval2); //insert new headline _root.news_dateTime.date.text=instance.news[instance.currentMessage].date; _root.news_dateTime.time.text=instance.news[instance.currentMessage].time; _root.news_text.txt.text=instance.trimToMaxCharCount(instance.news[instance.currentMessage].text); //change format var txt_fmt:TextFormat = new TextFormat(); txt_fmt.color = instance.textColor; _root.news_text.txt.setTextFormat(txt_fmt); //bring the headline back to its place ---> ---> <--- <--- _root.news_dateTime.tween("_y",Stage.height-_root.news_dateTime._height-4,0.5,"easeOutQuad"); _root.news_text.tween("_y",_root.news_text._y+25,0.5,"easeOutQuad"); //assign url and window to _root.news movie clip so we can find it easier _root.news_text.url=instance.news[instance.currentMessage].link; _root.news_text.window=instance.news[instance.currentMessage].window; //display headline information <3/27> _root.news_count.txt.text=(instance.currentMessage+1)+"/"+instance.news.length; },500); instance.interval=setInterval(instance.changeNews,instance.newsTimer*1000,true); } //news text events ------- STAT ------- function newsOnRollOver() { clearInterval(instance.interval); clearInterval(instance.interval2); var txt_fmt:TextFormat = new TextFormat(); txt_fmt.color = instance.overColor; _root.news_text.txt.setTextFormat(txt_fmt); } function newsOnRollOut() { clearInterval(instance.interval2); var txt_fmt:TextFormat = new TextFormat(); txt_fmt.color = instance.textColor; _root.news_text.txt.setTextFormat(txt_fmt); instance.interval2=setInterval(function(){clearInterval(instance.interval2);instance.changeNews(true);},1500); } function newsOnRelease() { getURL(_root.news_text["url"],_root.news_text["window"]); } //news text events ------- STOP ------- }
Não sei se é problema de _root que tá fazendo isso. A news.swf não é lida na raiz do index.swf, ela é lida 3 níveis acima. Dentro do index.swf temos:
Scene > mcMain > itens > news (aqui aparece o código loadMovie)
Ufaaaa...
Alguém pode me dar uma luz?
Vi algo parecido no fórum mas já mexi várias vezes e não consegui resolver, preciso da ajuda de programador mais avançado.
Obrigado pela atenção.
Abs!
#971131 Tamanho Swf Externo Com Loadmovie
Posted by J. Silvério on 17/06/2009, 16:42 in Adobe Flash e ActionScript
Olá a todos,
Não adianta, já procurei em TODOS os lugares e não consegui resolver.
Eu estou fazendo um site e usando loadMovie pra carregar um "banner rotator" de um SWF externo.
O que acontece?
Criei um MC vazio com nome de alvo e coloquei o seguinte: alvo.loadMovie("externo.swf");
Legal, ele carrega o externo.swf só que com problema de dimensão.
- O index.swf (onde o externo.swf é carregado) tem 1600 px X 1200 px.
- O externo.swf tem 600 px X 300 px.
Quando o externo é carregado dentro do index, a imagem fica no locar certo mas preload e o texto com informações da imagens ficam perdidos, nos cantos da página.
Como posso resolver isso?
Grato pela ajuda e um abs a todos,
J. Silvério
Não adianta, já procurei em TODOS os lugares e não consegui resolver.
Eu estou fazendo um site e usando loadMovie pra carregar um "banner rotator" de um SWF externo.
O que acontece?
Criei um MC vazio com nome de alvo e coloquei o seguinte: alvo.loadMovie("externo.swf");
Legal, ele carrega o externo.swf só que com problema de dimensão.
- O index.swf (onde o externo.swf é carregado) tem 1600 px X 1200 px.
- O externo.swf tem 600 px X 300 px.
Quando o externo é carregado dentro do index, a imagem fica no locar certo mas preload e o texto com informações da imagens ficam perdidos, nos cantos da página.
Como posso resolver isso?
Grato pela ajuda e um abs a todos,
J. Silvério
- Fórum WMO
- → J. Silvério's Content
- Privacy Policy
- Regras ·