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

Filename in a text file

Community Beginner ,
Mar 14, 2024 Mar 14, 2024

Ok, so I have written some png files in a .txt file...

"Bracelet.png"

"Boston.png"

"Camera.png"

I would like to know how I can turn them into URLRequests using Actionscript3.

I already know how to load them.

477
Translate
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 ,
Mar 15, 2024 Mar 15, 2024

this was already answered in loadImage() function.

Translate
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 Beginner ,
Mar 15, 2024 Mar 15, 2024

Oh thats right. Can I use that function with FileReference?

Translate
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 ,
Mar 15, 2024 Mar 15, 2024

what are you trying to accomplish that was answered previously?

Translate
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 Beginner ,
Mar 15, 2024 Mar 15, 2024

What I was trying to accomplish was loading an image that was described in a textfile.

Translate
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 Beginner ,
Mar 15, 2024 Mar 15, 2024

Written in a textfile, sorry.

 

Translate
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 ,
Mar 16, 2024 Mar 16, 2024

copy and paste the first few lines your text file.

Translate
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 Beginner ,
Mar 18, 2024 Mar 18, 2024

It worked! Thank you.

Translate
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 Beginner ,
Mar 18, 2024 Mar 18, 2024

So, the original code worked, but this was a code I used.

 

var myLoader: URLLoader = new URLLoader(new URLRequest("Slides/round1/slide1.txt"));
var myArray: Array = new Array();
 
myLoader.addEventListener(Event.COMPLETE, loadComplete, false, 0, true);
 
function loadComplete(e: Event): void {
myArray = myLoader.data.split("&prize:");
 
var loaderA = []; // this will contain the loaders that load the above bitmaps
var index: int = 0;
load_nextF();
 
function load_nextF(): void {
var loader: Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, load_completeF);
prizeslide.load(new URLRequest("Prizes/" + myArray[index]));
loaderA.push(loader);
}
 
function load_completeF(e: Event): void {
index++;
if (index < myArray.length) {
load_nextF();
// and you may, or may not want to do something here
} else {
// all loading is complete. 
}
}
}
 
And I got this error...
Error #2044: Unhandled ioError:. text=Error #2035: URL Not Found. URL: 
 
I don't know if I'm doing something wrong?
Translate
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 ,
Mar 18, 2024 Mar 18, 2024

you have the prizes folder/file names?

Translate
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 Beginner ,
Mar 18, 2024 Mar 18, 2024

Prizes/3-Wheeler.png

Prizes/Acapulco.png

Prizes/Air Conditioner.png

Prizes/San Diego.png

 

Just to name a few.

Translate
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 ,
Mar 19, 2024 Mar 19, 2024

that's not what the code is expecting.

 

it looks like the bitmaps should be in Prizes, but the name listing is supposed to be

 

3-Wheeler.png&Acapulco.png&Air Conditioner.png&San Diego.png

Translate
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 Beginner ,
Jul 17, 2024 Jul 17, 2024

There it is! That's the code I'm trying to do.

Translate
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 ,
Jul 17, 2024 Jul 17, 2024
LATEST

that's late, but good to hear.

Translate
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