emitter.textureFileName..Can you add a path to Documents or Tmp directories?

Working with emitters I would like the ‘User’ to be able to load their own particle image.

The ‘Parameters’ for an emitter have an "emitter.textureFileName=“file.jpg” property which loads the image from the system.ResourceDirectory. Unfortunately we are not supposed to use that location.

So my plan was to load an image using media.selectPhoto then save it out to an app directory as “tmp.jpg”

where I would supply the path and file to the emitter parameter.

​Below is the Listener from the media.select.

for testing i have put a “tmp.jpg” into system.ResourceDirectory and then I defined a variable “filename” to be “tmp.jpg” Then I can update the emitter.textureFileName and destroy/create a new emitter… Works fine…

What I don’t seem to be able to do is add a path to the system.DocumentsDirectory where the file will actually exist… Is it possible to do that?

Also, I thought that  emitter.textureImageData= may have accepted a pre loaded image but it doesn’t seem to, cant really find anything about that one.

local function gotParticleListener( event ) local image = event.target --print("image.\_properties: " .. json.prettify( image.\_properties ) ) local particleImageGroup = display.newGroup() particleImageGroup:insert(image) if image then --Have Loaded new image, so save it out as "tmp.jpg" to a local device location display.save( particleImageGroup , { filename = "tmp.jpg" , baseDir = system.DocumentsDirectory}) --The file I would like to access with activeSampleCopy.textureFileName local filename = "tmp.jpg" --This "activeSampleCopy" below is a working copy of the current emitters options. --The parameters are changed throughout the app and applied on the fly or dispose/createnew emitter where neccesary activeSampleCopy.textureFileName = filename or activeSampleCopy.textureFileName -- This works fine where "filename" is defined above. -- tidy up particleImageGroup:removeSelf() particleImageGroup = nil -- create a new emitter with the modified options createEmitter() else haveNewParticle = false end return true end

I have a helper with which you can change the path to the image after you generate your emitter definition:

https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/pex/

This is not fully documented, but see the example on that page.  altTexture changes the particle image and  texturePath changes the path.

You can also override any emitter setting as you create the emitter from the emitter definition.

This way you can create a base emitter definition and tweak parameters as you create the emitters.

Thanks for that Ed I will have another looks at it when I get a chance.

I have a helper with which you can change the path to the image after you generate your emitter definition:

https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/pex/

This is not fully documented, but see the example on that page.  altTexture changes the particle image and  texturePath changes the path.

You can also override any emitter setting as you create the emitter from the emitter definition.

This way you can create a base emitter definition and tweak parameters as you create the emitters.

Thanks for that Ed I will have another looks at it when I get a chance.