• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Problens with AS1 to AS3

New Here ,
Jan 14, 2014 Jan 14, 2014

Copy link to clipboard

Copied

Hi dear friends

I'm too rusty with flash but today appearl a problem

I have this code is in AS1 and needs to be in AS3...

Is an RSS code with title and description only...

if some one can insert a picture, please tell...

titulo2 and texto2 are drop shadows

System.useCodepage = true;

loadNum = new Loadvars();

loadNum.onLoad = function (ok)

{

    var __reg1 = _root;

    if (ok)

    {

        __reg1.titulo.text = __reg1.loadNum.titulo;

        __reg1.titulo2.text = __reg1.loadNum.titulo;

        __reg1.texto.text = __reg1.loadNum.texto;

        __reg1.texto2.text = __reg1.texto.text;

    }

}

;

loadNum.load("rssnews.dat");

trace(numPics);

TOPICS
ActionScript

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 14, 2014 Jan 14, 2014

titulo2 and texto2 are textfields or your as1 code is incorrect.  (however, they may appear to be dropshadows because of offset and alpha manipulations.)

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE,completeF);

urlLoader.load(new URLRequest("rssnews.dat"));

function completeF(e:Event):void{

var __reg1:MovieClip=MovieClip(root);

__reg1.titulo.text=XML(urlLoader.data).titulo;

etc

}

Votes

Translate

Translate
Community Expert ,
Jan 14, 2014 Jan 14, 2014

Copy link to clipboard

Copied

titulo2 and texto2 are textfields or your as1 code is incorrect.  (however, they may appear to be dropshadows because of offset and alpha manipulations.)

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE,completeF);

urlLoader.load(new URLRequest("rssnews.dat"));

function completeF(e:Event):void{

var __reg1:MovieClip=MovieClip(root);

__reg1.titulo.text=XML(urlLoader.data).titulo;

etc

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 15, 2014 Jan 15, 2014

Copy link to clipboard

Copied

ok I tried but still not working

now I deleted that text that appears like dropshadows

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE,completeF);

urlLoader.load(new URLRequest("rssnews.dat"));

function completeF(e:Event):void{

var __reg1:MovieClip=MovieClip(root);

          __reg1.titulo.text=XML(urlLoader.data).titulo;

          __reg1.texto.text=XML(urlLoader.data).titulo;

}

but the text doesn't appear...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2014 Jan 15, 2014

Copy link to clipboard

Copied

use the trace function to debug:

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE,completeF);

urlLoader.load(new URLRequest("rssnews.dat"));

function completeF(e:Event):void{

var __reg1:MovieClip=MovieClip(root);

trace(XML(urlLoader.data));

}

paste the (first 50 or so lines of) trace output in this forum.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 16, 2014 Jan 16, 2014

Copy link to clipboard

Copied

Ok, thanks but now appear another BIIIIIIG problem...

the situation is it:

I have a led painel and in his playlist have a very very old rss reader ( I can't change it ), and it read from a .FLA  AS1 ( in flash player 6 )

flash player 6 doesn't run videos in .flv as background... So I exported the .swf in flash player 8 but appear this erro

output - undefined

Compiler errors - The identifier 'Loadvars' will not resolve to built-in object 'LoadVars' at runtime.

my action frame

 

System.useCodepage = true;

loadNum = new Loadvars();

loadNum.onLoad = function (ok)

{

    var __reg1 = _root;

              if (ok)

    {

        __reg1.titulo.text = __reg1.loadNum.titulo;

        __reg1.titulo2.text = __reg1.loadNum.titulo;

        __reg1.texto.text = __reg1.loadNum.texto;

        __reg1.texto2.text = __reg1.texto.text;

    }

}

;

loadNum.load("rssnews.dat");

trace (numPics);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 16, 2014 Jan 16, 2014

Copy link to clipboard

Copied

Trying by AS3 it appear the text in the output

titulo=R7&texto=Forças russas enfrentam militantes antes dos Jogos de Inverno; 7 ...&

my code

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE,completeF);

urlLoader.load(new URLRequest("rssnews.dat"));

function completeF(e:Event):void{

var __reg1:MovieClip=MovieClip(root);

                    trace(XML(urlLoader.data));

}

I just need to put these "titulo" and "texto" from .dat in two separeted dynamic texts (titulo, text)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2014 Jan 17, 2014

Copy link to clipboard

Copied

Hi guys

now I change almost everything and IT WORKED

my new code

var loader:URLLoader = new URLLoader();

loader.dataFormat = URLLoaderDataFormat.VARIABLES;

loader.addEventListener(Event.COMPLETE, loading);

loader.load(new URLRequest("content.txt"));

function loading (event:Event):void {

news_1.text = loader.data.var_1;

news_2.text = loader.data.var_2;

}

here works fine, but when I repleace my "content.txt" to "rssnews.dat" file to load, it appear

Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.

          at Error$/throwError()

          at flash.net::URLVariables/decode()

          at flash.net::URLVariables()

          at flash.net::URLLoader/onComplete()

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2014 Jan 17, 2014

Copy link to clipboard

Copied

use:

loader.dataFormat="variables";

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2014 Jan 17, 2014

Copy link to clipboard

Copied

where??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2014 Jan 17, 2014

Copy link to clipboard

Copied

oops, that is the problem.  you added that code.

just use the code i suggested which uses urlLoader.dataFormat="text", by default and that is the correct format for reading rss data.

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE,completeF);

urlLoader.load(new URLRequest("rssnews.dat"));

function completeF(e:Event):void{

var __reg1:MovieClip=MovieClip(root);

trace(XML(urlLoader.data));

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2014 Jan 17, 2014

Copy link to clipboard

Copied

and where i put the dinamic texts ?

news_1.text

news_2.text

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2014 Jan 17, 2014

Copy link to clipboard

Copied

copy and paste the first 20 or so lines of that trace output here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 21, 2014 Jan 21, 2014

Copy link to clipboard

Copied

the AS

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE,completeF);

urlLoader.load(new URLRequest("rssnews.dat"));

function completeF(e:Event):void{

var __reg1:MovieClip=MovieClip(root);

trace(XML(urlLoader.data));

     __reg1.news_1.text = trace(e.target.data.titulo);

     __reg1.news_2.text = trace(e.target.data.texto);

}

The output

titulo=R7&texto=Forças russas enfrentam militantes antes dos Jogos de Inverno; 7 ...&

ReferenceError: Error #1069: Property titulo not found on String and there is no default value.

          at NoticiasRSS_fla::MainTimeline/completeF()

          at flash.events::EventDispatcher/dispatchEventFunction()

          at flash.events::EventDispatcher/dispatchEvent()

          at flash.net::URLLoader/onComplete()

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 21, 2014 Jan 21, 2014

Copy link to clipboard

Copied

use:

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE,completeF);

urlLoader.load(new URLRequest("rssnews.dat"));

function completeF(e:Event):void{

var __reg1:MovieClip=MovieClip(root);

var a:Array=e.target.data.split("&");

     __reg1.news_1.text = a[0];

     __reg1.news_2.text = a[1];

}

p.s. you may need to caste a[0] etc as a string

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 21, 2014 Jan 21, 2014

Copy link to clipboard

Copied

Ok now the text appeared

imagem_amostra.jpg

but I don't want to see the "titulo=" and the "texto="

is possible?

thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 21, 2014 Jan 21, 2014

Copy link to clipboard

Copied

use:

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE,completeF);

urlLoader.load(new URLRequest("rssnews.dat"));

function completeF(e:Event):void{

var __reg1:MovieClip=MovieClip(root);

var a:Array=e.target.data.split("&");

     __reg1.news_1.text = a[0].split("=")[1];

     __reg1.news_2.text = a[1].split("=")[1];

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 21, 2014 Jan 21, 2014

Copy link to clipboard

Copied

It WORKED!!!!! You saved my life

Thanks a lot

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 21, 2014 Jan 21, 2014

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines