Embed images using FlashDevelop - AS3 - image

I'm not finding much documentation on embeding images in .as files. Really, I'd like to have some theory on it. So far from what I got reading here and there:
I placed an image in Assets folder inside src. Then right-clicked the image and clicked "Generate embed code", then this code line appears where the cursor was [Embed(source="fluffybunny.png")] what now? How do I assign it to a variable or something... I really didn't find it out there.
Instead of given object using .graphic atribbutes I want to use an image.
Also, does it have to be an .SWF?

There are quite a few resources on this (when you search for "as3 use embed tag"). Some of them are really helpful:
http://www.bit-101.com/blog/?p=853
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf680e1-7ffe.html
The most basic thing is that you declare a variable of some type. And you use the [Embed] tag before the variable declaration. It's some kind of weird association. Something like:
[Embed(source="image.jpg")]
public var imageClass:Bitmap;
// later on you can instantiate it and use:
addChild(new imageClass()); // creates and adds new image
This is just a sample - there are a lot of types and ways to do it - give a shot the Adobe reference, there are tons of samples.

Related

How does ImageSource return bytes to the application

I would like to implement my own subclass of ImageSource. Xamarin Forms has FileImageSource, UriImageSource and several other subclasses of ImageSource, but none of them meets my needs.
To see how to implement an ImageSource subclass, I looked at implementation of FileImageSource on github (https://github.com/xamarin/Xamarin.Forms/blob/5.0.0/Xamarin.Forms.Core/FileImageSource.cs)
I expected to find that the subclass would override one or more ImageSource methods to actually read the image file and provide the bytes from the file to the calling platform. But source code of FileImageSource contains no such thing! In fact, they use the File only to override ImageSource.IsEmpty. How can this be? If an image is contained in a file, you need to read the file to display this image, don't you?
What am I missing? And if I want to implement my own subclass of ImageSource, how can my sublass return image data to the platform?
Edit
Thank you to everyone who proposed solving the issue in a different way and inquiring why exactly existing ImageSource subclasses do not serve my needs.
Even if there is a different way to solve my immediate issue, from an educational perspective it is still interesting to know how Xamarin Forms displays an image file without reading the file. The source code for FileImageSource is quite short and does not appear to use the file, other than to implement IsEmpty. This will bug me until I know how this works.
[Resolve the issue using converters]
Instead of creating a new ImageSource, you could create a Converter (if you are working with bindings).
So if you have something like a byte array, and you want that to be shown as an image, you can do the conversion from byte array into a StreamImageSource
[EDIT: Knowing how it works]
If you want to know how it works internally and how it transforms the File into the actual Image, you will have to go deeper into the code, and check the platform implementations.
For example here you have the android renderers. You will find the IImageSourceHandler.cs and the FontImageSourceHandler and the FileImageSourceHandler and so on.

How to create a presentation using .svg files representing each slide

This question is motivated by the answer given in this question
Using the animate package without adobe
I want to create latex beamer presentations without relying on adobe, as it is a pain.
I followed the instructions given in the post's answer, and when compiling the given example code, the output were 4 .svg files, and I have no idea on what to do with them.
Something tells me they should be embedded into an html file that produce a slide-presentation, but I'm a complete noob in html and I've not been able to find an answer on how to achieve this.
No additional wrapper for the individual .svg files is necessary. Simply open the first .svg file in your browser and use the little arrows at the top right for navigation. They automatically link to the next slide.

Display an image over the screen

I have a map that is 40x50 that shows when the visitor comes to the website, i would like the visitor to click the map which puts in topmost actual size 400x500 and everything beneath is blacked out, when they click off the pic it will simply vanish.
I have seem it happen in many galleries but can't seem to find one i can recode and don't even know what the actual process of doing this is called.
I believe the word you're looking for is lightbox.
See this: http://lokeshdhakar.com/projects/lightbox2/
By the way, tags are for tagging what languages you are using. Appropriate tags for this post would probably be html and javascript. The image tag is alright, but without context, it's difficult to figure out how your are trying to implement it.

Overidding imshow

When I use the following,
imshow(imread('image1.jpg'));
imshow(imread('image2.jpg'));
imshow(imread('image3.jpg'));
imshow(imread('image4.jpg'));
imshow(imread('image5.jpg'));
imshow(imread('image6.jpg'));
I got only image named image6.jpg in the output figure.
There is also an option figure,imshow(...); to view all the images each in new window.
But writing figure in each line where I need to view the image is a repeated and tedious process. Is there any other solution to get the same output as with figure,imshow(..);
without using figure function.
I mainly put on this question because while programming a lot somewhere we forget to use the figure function and so the image that we need to view wont be visible. It would have been overwritten by other image. So provide me some solution.
I ask this only for simplicity in writing the code. So if there is any solution, please mention.
Thanks in advance.
I'm not sure, but I don't think that there's a workaround to that. MATLAB basically changes the current figure handle to that of a new image when you use imshow. One thing you can do however is to make a copy of imshow in your local directory and edit it accordingly to make your own UDF.
What I would recommend however (so as to preserve functionality across systems) is that you open your code is an editor and replace all imshows with figure, imshow. This should be easy enough and it'll be easy to revert back as well.

Dynamically Generate Editable PDF

Is there a way to create an editable PDF programmatically? By editable, I mean you can click in a text area and type in your name, that kind of thing.
I'm using Ruby and have found PrinceXML and Princely to be nice projects. I'm wondering if they could do that?
Prince doesn't mention forms in the documentation, and renders forms as static drawings, so I doubt it.
pdfTeX can do it with the hyperref package. Here's a tutorial.
Example:
\usepackage{hyperref}
\begin{Form}
\TextField[backgroundcolor={1 1 0},value=can do forms]{hyperref}
\end{Form}
It looks like this:
screenshot http://grab.by/23nP
(Of course, then you're using TeX instead of whatever reports library you like. I'm sure there's an alternative.)

Resources