Flex: get path of image to transcode - actionscript-3

I just started learning Flex this week, and I cannot get an image path to work. My folders are as follows:
ProjectFolder
-src
--assets
--skins
-bin
My image is in assets, we can call it image_name.jpg and my skin is in the skins folder. How would I put it as the source of a bitmap in a custom skin?
Broken Attempt:
source="#Embed(source='/assets/image_name.jpg')"
as a property of a s:BitmapImage MXML tag.
Thanks!

Ok, you save the image in src/assets and use:
source="#Embed('assets/image_name.jpg')"
Source: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/primitives/BitmapImage.html#includeExamplesSummary

Related

How to embed images in Angular which lie in another directory than assets?

I have an Angular Application with the following structure:
Structure
As you can see, there is a backend directory (yellow marked) in which other directories exist, such that the following path is valid: backend/uploads/users/user123/unnamed.jpg.
Now I want to use that image in my app.component.html
<img src="">
I tried to put the path in the src-property in different ways but the image is not appearing. How would the src has to look like to use that image in my Angular project?
I guess you are using the angular CLI. Therefore you should put the image in the assets folder. Try again than and it will work.
Like this:
<img src="/assets/images/unnamed.jpg">
EDIT: I am sorry, did miss out that part. You need to edit the angular.json file for this. Add the path of the backup folder there to the assets. But the backup folder must be in the src folder for this to work. Thats my suggestion for a solution.
So you will be adding "src/backup"
I don't think what you want to do is actually feasible. if you want to use an image in an Angular app, it's either an asset and you put it in the assets folder, or it's a resource coming from your backend and you will have to write a proper mechanism to expose the wanted resource, and then use it in your Angular app.

Image relative path not working with Angular

I'm trying to display an image stored in my /public/img/"image_file" project's directory system.
/home/adrian/Escritorio/proyectos/mean-social-network/frontend/src/app/public/img/beach2.jpg
I'm need to display it from the next component HTML file: index.component.html
Why this relative path is not working?
Thanks for reading.
actually, you should have assets folder in one level with the app folder
and you can write URL in the components and HTML parts like this:
<img src="/assets/*.svg">
background-image: url('/assets/*.svg');

Merge BitmapFont and UI skin in single Atlas?

If I have a UI with a .atlas and a BitmapFont with a .atlas is there a simple way to combine these into one or do I have to merge them myself in a image file and manually offset all the elements in the combined .atlas to the correct position? It is doable manually but kinda tedious, and if there is a slight calculation error one might have to redo every position and/or size.
Yes you can! Just let TexturePacker do the packing work for you:
Put the BitmapFont's .png file in the same folder where TexturePacker reads your images to pack. The same folder where all the other images are
Put the BitmapFont's .fnt file in the same folder where your skin's .atlas file is (usually in the assets folder inside android project)
Refresh the assets folder in eclipse (just in case..)
Now you can use the Bitmap font in the styles.json, like for example:
com.badlogic.gdx.graphics.g2d.BitmapFont: {
default-font: { file: somefont.fnt }
}

Embed jpeg into SWF at compile (without fla file)

Users upload images and select a template AS3 file, which would be used together with the images to compile into a SWF and be downloaded by the user.
Basically, use my own custom animations with the user's resource files in order to compile a new SWF at run-time.
I found a tool called "swftools", which can convert images into a slideshow, so I know something like this is partly feasible, I just don't know enough about AS3 to know how to load resources dynamically, without creating a FLA file manually.
EDIT: To clarify, I do not want to dynamically load an image from a URL or file at run-time. I want to embed the image into the SWF, but the image data is decided at compile-time.
Same problem here, and I found some great tuts that show how it's done, but (unfortunately) in AS2 (not AS3):
loading images
The code to convert:
loadMovie("photo.jpeg",photo.empty);
loading text
The code to convert:
myData = new LoadVars();
myData.onLoad = function () {
myText_txt.text = this.myVariable;
};
myData.load("myText1.txt");
AS2 to AS3 is very poorly documented, even for small scripts…
If you have a solution I'd like to know it ;-)
Use Flex and compc compiler.
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fd2.html
You can modify as3 sources on server and embed your images with [Embed(source='path/file.ext')] directive, run compc and get final swf...

Is there a way to render svg data in a swf at runtime?

I'd like to render to svg data in a swf at runtime (not in Flex - not using degrafa) - how would I go about doing that?
If ActionScript 2:
Use the com.itechnica.svg (PathToArray) library to load SVGs at SWF runtime and display them (uses XML for SVG parsing):
Using SVG Path Data in Flash, Code download button on the right pane.
If ActionScript 3:
Use the com.zavoo.svg (SvgPath) library to load SVGs at SWF runtime and display them (uses RegExp for SVG parsing):
Source code for SvgLoad and SvgDraw, Code download button on the bottom-left.
The Ajaxian blog had a post about this today.
http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer