• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Reading

 
Booma Devi
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can anyone please help me how to read the properties file at runtime in flex?

I have created the .properties file outside of src folder and i used the ResourceManager.getInstance syntax...

In my machine code is working fine without anyerror.. If i run it on another one's machine i am getting an error "cannot read local resource file"..

Is there any possibilities of reading properties file at runtime...
 
Praveen Kumar M K
Ranch Hand
Posts: 256
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you used full path or relative?
 
Booma Devi
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Praveen,

Thanks for your reply.. I used URL loader class for reading text file at runtime... Now its working fine in my machine as well as other's machine.. I have setup my file path to trusted local settings..
 
Praveen Kumar M K
Ranch Hand
Posts: 256
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great! You could still use Resource manager, but the properties file has to be part of the resource bundle...
 
Booma Devi
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried to read the properties file using resource manager.. But it worked only when the property file located outside of src folder...

Is it possible to read the property file at runtime? (property file should be present inside the src/properties/resource.properties)

If so, can you please give me a simple program for this...
 
Praveen Kumar M K
Ranch Hand
Posts: 256
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you talking about flex source folder or java (back end) src folder?
 
Booma Devi
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am talking about flex/src folder..

 
Praveen Kumar M K
Ranch Hand
Posts: 256
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, have a look at this link - http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f3c.html

In general if you need to use properties file, it would be better to create bundles. From the link you can see that the below are the steps to accomplish our task.

1) Create property files.
2) Include the names of the created property files under the bundle list.
3) Then include the bundle list in the Flex compiler arguments.
4) Then use them from Resource manager.

In case you want a conventional Property reader sort of functionality, you could use the url class loader and give full path.


 
Booma Devi
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much....But, if we give the bundle list in the compiler arguments list, each time SWF will be generated. I think, URLLoader is the better one.. Thanks for spending your time.


 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic