Loading images dynamically
Hi,
This is my code.
[Embed(source="C:/images/temp.jpg")]
var uploadedImage:String;
imgPhoto.source = uploadedImage;
Every time the image changes, I need to dynamically load the new image. But flex seems to cache the image somewhere.
I cannot get the new image to display. Any suggestions. Thank You.
For your kind information flex doesnt cache any image. use Bindable as follows
[Embed(source="image")]
[Bindable] -- Important
public var Logo:Class;
]]>
</mx:Script>
When the source changes image also changes
image.source = Class;
good to go....
Similar Messages
-
Problem with loading images dynamically in a pdf document
dear,
I am using live cycle designer and i need to load image from a url dynamically in to the document.For this case i placed an imagefield on my document and i wrote javascript to load image in the form:ready event.
My script for that was
imagefield.value.image.href="url".Actually i saw an imagefield in my document but it doesnt carry any image.Please help me to rectify this problem......If you save your form as Static PDF, it works.
But most of the time we need the Dynamic XML form. So, I am also stuggling with this issue.
Nith -
XML to load images dynamically
Hi,
I have an XML file which is programmed to load images into a slide show dynamically. So it must be associated with a button to launch this I'd imagine.
If I want to add more buttons, do I simply add more script to that one XML file giving the new images different names than what was used with button #1, or do I create an XML file for each button and upload all to the web?
Thanks.xml files can't program anything. they store data (and are there a from of database).
it's not clear what adding more buttons has to do with your xml file. is there data in the xml file that relates to buttons?
and it's not clear what images and a slide show have to do with anything.
but commonly, an xml file would store data about what images to display in a slideshow. and the xml file might even contain text to display for each image and possibly an external link associated with each image and maybe some specifics about how to display the image. -
Loading Images Dynamically from MySql
Hello
I need to load images in my swf file dynamically from MySql
using PHP. Brief is I have one Swf file and and i want to animate
image in it but image should be come from dynamic path.. anybody
can tell me how to do this? if you want more brief then i can
provide it but it is urgent...
Thanks in advanceI'm afriad I don't have a solution to your problem but I was
curious as to why you would load it from a database vs a directory.
I know you can have users upload to a directory and a database but
I don't understand the benifit since I think you'd be adding load
on the database server. Is it a server side image manipulation
thing? -
Load image dynamically by scripting to dynamic xml pdf, is it possible?
Hi All,
I've uploaded static pdf form to http://groups.google.com/group/livecycle/web/logo.pdf.
The form contains ImageField.
In the "docReady" event of the form I wrote a script:
ImageField1.value.image.href="http://www.quicksoft.co.il/images/
quicksoftlogo2.jpg";
When the form is loaded the ImageField shows the image from the url
I've updated in the script.
Once the form is saved as dynamic xml pdf the script stop working.
Is that means that it is not possible to load images by scripting to
dynamic xml pdfs?
Anyone familiar with workarounds for it?
Thanks in advance,
RbuzI got an answer from Adobe:
Dynamic change of an image href has been disabled due to potential security issues. There are however a few workarounds to choose from:
1. Embedding the images in the form as hidden objects. They can then be set to visible on initialize or clicking a button. This will affect performance, but if the images are in a compressed format, this can be minimized.
2. Create a Web service interface to grab the image from wherever they are stored, base64 encode it and return it to the form. You would also have to update the bindings for the image field on the form (a one time operation). -
Problems loading images dynamically with XML
Hi Everyone,
I am working with a project that was build by another
developer and I have been asked to modify it several ways. This is
an interactive map for a hotel brand where when you click on the
USA, you get a list of all the states, click a state and a list of
all the hotels in that state comes up, click a hotel, the hotel's
information is displayed. I understand the structure of the files,
how they make them work, though I couldn't build it myself.
The problem I am having is this. can't make the hotels'
photos load into the flash through the XML. I created a target
movie file that the image could load into but something is not
happening as far as loading the images. I don't know if the movie
clip that I created is the right way to go (it was made as an
object in the library that is exported via AS), or if I should
create one in the action script file that loads the XML data.
I looked at some tutorials about how to load images with XML
but those didn't get into the level of detail that I need for this
project.
I've attached some partial code to see if anyone can help me
work through this.
Any and all suggestions are welcome.
Thanks for the help in advance.
JeremiahI'm a noob at AS3 and trying to learn this XML stuff myself,
but i have been able to load pictures to the stage...this might
help you...my xml file photo section is similar to yours, only I
have it labeled as "href" instead of "source"...
var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("xmldata/images.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event) :void {
xml = XML(event.target.data);
xmlList = xml.children();
for (var i:int = 0; i<xmlList.length(); i++) {
imageLoader = new Loader();
imageLoader.load(new URLRequest(xmlList
.attribute("href")));
imageLoader.x = 0;
imageLoader.y = 0;
addChild(imageLoader); -
Sandbox error, crossdomain loading Images dynamically
Hi!
I have a following image:
<mx:Image id="listakuva1"
source="images/autoListasivu.jpg"
complete="handleImageComplete(event)" />
And because I have to scroll the image, I have to turn the
smoothing on when complete:
private function handleImageComplete(event: Event): void {
var bitmap: Bitmap = ((event.target as Image).content as
Bitmap);
if (bitmap != null) {
bitmap.smoothing = true;
This works fine. But then I want to change the image when
user does something:
listakuva1.load("new image in another domain via URL");
And it gives me security sandbox error. I googled and I found
that I should put:
checkPolicyFile = true;
to somewhere but I can't figure out WHERE!
The images are still loaded without the warning but the
smoothing-function is not working.
PLS Help.
BR TimoHi,
It would be great if you can post a simple sample. I can try
it out on a Mac and let you know. -
i'm loading images dynamically. The images that will be
uploaded will very rarely be of the exact same dimensions, so
scaling percent wise doesn't exactly do what I want. I would like
to scale an image up and down to a precise amount of pixels (say,
116(width)*86(height)).once the image is loaded completely (onLoadInit Event must be
fired if using MovieClipLoader) you can access the size of the
image via the _width and _height properties.
The logic to code would be to check the size of the image and
check if it fits into a virtual bounding box that marks the max
width and height for the images as they should be dispayed.
If one (or both) sides of the image exceeds the maximum
width, calculate the percentage by which you must scale the image
down to fit this sied into the "box". Apply this factor to BOTH the
widht and the height, then check if the other side of the image is
still to big to fit into the box and repeat the downscaling if
needed. -
Part 2: Load Image from URL into Dynamic Text Box - goodinson.snapshot
I have a flash file where a user can add an image url into a Dynamic Text Box (image_in.text) and the image will now appear in the flash file.
I am using goodinson.snapshot as featured in this article: Saving Flash graphics as image files at runtime | Adobe Developer Connection
This application works fine (graphic is generated and downloaded) only if a user chooses an included graphic in the flash file (loaded externally) or if I declare a url inside the flash file for the load image variable (var image_url:String = "http://website.com/image.jpg";).
However, if a user enters an image url into the Dynamic Text Box (image_in.text), which the flash does successfully load, the download image function no longer works!
Is this a security bug in flash itself? Or am I missing a code tweak somewhere?
If an FLA that does this already exists somewhere, let me know.
Thanks in advance for your help!Thanks for your response!
The image urls are on the same domain as where the swf is.
I don't understand how declaring the variable as the url is different from declaring it from the value of a dynamic text box... it's the same url, but only one method works, shouldn't they both work?
var image_url:String = "http://website.com/image.jpg"; works..
var image_url:String = image_in.text; does not work, even though the value for image_in.text is identical to the one in the example above.
Since they are all on the same domain, this should work, right?
Thanks again. -
In dynamic pages do not load images or styles
MAMP as a local server, when I open in Edge a dynamically generated page (Wordpress) in iPhone or iPad does not load images or CSS. But if I open a static page everything works correctly.
I tried to change the ports from localhost:8888 to localhost and not work either.Hi,
This is a known issue with the way Wordpress generates the URLs to included content:http://forums.adobe.com/message/4774943
Wordpress generates absolute URLs to content rather than relative URLs, so the current workaround is to either use relative URLs or, if that's not possible, modify the wordpress configuration to use the IP address instead of localhost.
Hope this helps,
Mark -
Dynamically loading images: UI Loader issue
I posted this last week, but did not show good examples to get help. Admittedly, I am new to flash, so this may be a bit elementary, so my apologies in advance. I am trying to dynamically load images through the UI Loader component. Attached are the errors I get, and although I think that the coding is close to correct, when I publish, it just flashes up then restarts the movie... any ideas? Thanks in advance.
there's a problem attaching things to this forum. so, nothing is attached.
can you copy and paste your error messages to this forum? -
How to dynamically load images into Flash
I have a movie clip on the stage that I want to dynamically
load images into (that constantly change), how would I go about
doing this? Thanks.Use the Loader class to load in images.
Then use addChild to add the Loader class into your MovieClip
on the stage.
As far as &quot;constantly change&quot; what
do you mean by that? You could use setInterval, ther enterFrame
event, or any other means to trigger a new image to be loaded into
the Loader instance.
Finally, you can use the Tween class to create some nice
effects for the images (fade it, blur in, photo blend, masks,
etc) -
Dynamically loaded images cached?
We have an xml feed that is refreshed every hour. According
to the xml file, we dynamically load an image into an html text
field each time someone hits our page. All of the images have been
recently updated, but the old ones are still appearing? We use the
swf?nocache=randomnumber convention to make sure the swf file
itself isn't cached, but is there anything we can do to clear out
the cache of dynamically loaded images? If there isn't anything we
can do, will these all eventually refresh themselves? This is how
the html is generated where "twcImage[0]" is the image in question.
Thanks!Do the same random number for the images.
twcImage[0] + randomnumber
Dan Smith > adobe community expert
Flash Helps >
http://www.smithmediafusion.com/blog/?cat=11
http://www.dsmith.tv
"Wolli World" <[email protected]> wrote in
message
news:fvvcrc$k9o$[email protected]..
> We have an xml feed that is refreshed every hour.
According to the xml
> file,
> we dynamically load an image into an html text field
each time someone
> hits our
> page. All of the images have been recently updated, but
the old ones are
> still
> appearing? We use the swf?nocache=randomnumber
convention to make sure
> the swf
> file itself isn't cached, but is there anything we can
do to clear out the
> cache of dynamically loaded images? If there isn't
anything we can do,
> will
> these all eventually refresh themselves? This is how the
html is
> generated
> where "twcImage[0]" is the image in question. Thanks!
>
> twcTarget.text = "<img align='left' hspace='5'
vspace='0' src='
http://" +
> _root.server + "/rss/weather/images/" +
> twcImage[0] + "'>" + "<condition>" + ... and so
on
> -
Get width and height of a dynamically loaded image once it's done loading?!
hello : :
well... i'm taking my first shots at flex after programming
in flash for a year now. it's been fun and i've been picking up on
things pretty well (or so i think), but i come across something
today that i used to be able to do in my as2 programming and don't
know how to do in as3...
in flex, i'm loading an image into an image control (by using
"myImgControl.load(urlString)"). i have a "complete" parameter on
the image control that calls a function just fine after the image
is loaded, but if i try and check the hight and width of the loaded
image once it loads, it comes back as zero. how can i get the
height and width of the image after it's loaded?!
in flash/as2 i used to do this little trick/work-around i
found in a forum (kirupa.com, i think) to find out the width and
height once the loaded image listener checked the loading process
and came back "complete"... in the code below, "imgLoader" is the
movieClip the image was loaded using
imgLoaderListener.loadClip(urlString, imgLoader).
quote:
iTot = imgLoader.getBytesTotal();
iLoad = imgLoader.getBytesLoaded();
if (iLoad == iTot && iTot > 4) {
imgH = imgLoader._height;
imgW = imgLoader._width;
that all make sense?!
basically, it's as simple as this: i need to find something
similar to the above for as3 that will tell me the width and height
of a dynamically loaded image after it's done loading...
so there ya have it. i appreciate any help any of you can
throw my way! thank you so much for even reading this!
: : michaelI assume you have probably already figured this out, but just
in case, there should be an event to listen for after which you can
get the height and width information successfully. I can't remember
the exact name, however. Experiment and see which one works
time-wise. -
Alpha transparency borders on dynamically loaded images for use with textures
Hi there folks. Well, I have been beating my head over this
and am hoping one of you can help me out.
Essentially I have 16bit images that are loaded into my
shockwave application at run-time. These images are user defined
which means that I will not know their size ahead of time. Once the
images are loaded I then create textures and apply them to various
shaders. Ok, all of this works just fine. What I need to do though
is create an alpha transparent border around the images, so when I
apply them to their surfaces I only see the image and nothing
around it. I am doing this because these images will only appear at
specific parts on a surface, textureRepeat will be false, and many
models will be stacked in the same exact location using the same
model resource. I have everything working, but I cannot figure out
the alpha part for the life of me. Also, when I test the alpha
based image by itself it works just fine. It is not until I try and
combine the 16bit (converted to 32bit at run-time) image that I run
into problems.
I have tried:
- Creating a 32bit alpha image in Fireworks with a
transparent border and a black rect for the inside. I then copy the
dynamic image over the alpha image (only after going from 16bit to
32bit in imaging Lingo) and leave a little room at the edges for
the transparency. Well, I get a crazy amount of streaks here even
when I try to up the trans border by around 24 pixels on each side.
- Using another similiar alpha based image as a mask with
copyPixels and extractAlpha/setAlpha like this... (code is a little
rough here)
newImage = new(#bitmap)
newImage.name = "place_Test"
newImage.image = member("place").image
newAlpha = new(#bitmap)
newAlpha.name = "AHH"
newAlpha.image = image(newImage.image.width + 24,
newImage.image.height + 24, 32)
newAlpha.image.useAlpha = true
newAlpha.image.copyPixels(member("vase").image,
newAlpha.image.rect, member("vase").image.rect)
newAlphaInfo = newAlpha.image.extractAlpha()
newAlpha.image.useAlpha = false
--reverse dark to light
iAlphaReverse = image(newAlpha.image.width,
newAlpha.image.height, 8, #grayscale)
iAlphaReverse.fill(iAlphaReverse.rect, rgb(0,0,0))
iAlphaReverse.copyPixels(newAlphaInfo, iAlphaReverse.rect,
newAlphaInfo.rect, [#ink : #reverse])
--newAlphaInfo.copyPixels(iAlphaReverse, newAlphaInfo.rect,
iAlphaReverse.rect, [#ink:#subtractpin])
newAlphaMask = iAlphaReverse.createMask()
rescaleAbs(newImage, newImage.image.width,
newImage.image.height, "place_Test", 32)
destImage = member("place_Test").image.duplicate()
destImage.fill(destImage.rect, rgb(0,0,0))
newAlpha.image.useAlpha = false
destImage.copyPixels(newImage.image, newImage.image.rect,
newImage.image.rect, [#maskImage:newAlphaMask, #ink:#add])
destImage.setAlpha(iAlphaReverse)
destImage.useAlpha = true
member("place_Test").image = destImage
I apologize for the messy code. I have cut and pasted from
all over the place and am getting confused. In any case, I think I
am making this harder then it needs to be and hope someone can
help.
Thank you in advance,
DaveHi, you can try using other texture layer as mask on the same
shader. As usually you create the texture from a dynamic loaded
image, then apply this texture to the shader on the texture list
index 1 (textureList[1]). Next part does the job, create other
texture from a 32 bits image with the alpha information and fill
all pixels with white color, this is very important because the
second texture layer will be multiply with the first texture layer.
This texture set its render format to rgba8888. Apply the mask
texture to the same shader at texture list index 2, verify that the
blendFunctionList index 2 is #multiply.
I include the code of a project that use this masking
approach:
property pMember
property pEarthSphere
property pNightSphere
property pLastTransform
on beginSprite me
pMember = sprite(me.spriteNum).member
me.setupWorld()
end
on setupWorld(me)
pMember.resetWorld()
repeat with i = pMember.light.count down to 1
pMember.deletelight(i)
end repeat
vEarthModelResource = pMember.newModelResource("EARTH MODEL
RESOURCE", #sphere)
vEarthModelResource.radius = 50.000
vEarthModelResource.resolution = 20
vEarthTexture = pMember.newTexture("EARTH TEXTURE",
#fromCastMember, member(3,1))
vEarthShader = pMember.newShader("EARTH SHADER", #standard)
vEarthShader.emissive = color(255,255,255)
vEarthShader.flat = TRUE
vEarthShader.transparent = FALSE
vEarthShader.textureList[1] = vEarthTexture
pEarthSphere = pMember.newModel("EARTH MODEL",
vEarthModelResource)
pEarthSphere.shaderList = vEarthShader
vNightModelResource = pMember.newModelResource("NIGHT MODEL
RESOURCE", #sphere)
vNightModelResource.radius = 50.2000
vNightModelResource.resolution = 20
vNightTexture = pMember.newTexture("NIGHT TEXTURE",
#fromCastMember, member(4,1))
vNightTexture.quality = #lowFiltered
vNightTexture.nearFiltering = FALSE
vNightTexture.renderFormat = #rgba8880
vNightShader = pMember.newShader("NIGHT SHADER", #standard)
vNightShader.emissive = color(255,255,255)
vNightShader.flat = TRUE
vNightShader.transparent = TRUE
vNightShader.textureList[1] = vNightTexture
vMaskNightTexture = pMember.newTexture("MASK NIGHT TEXTURE",
#fromCastMember, member(6,1))
vMaskNightTexture.renderFormat = #rgba8888
vNightShader.textureList[2] = vMaskNightTexture
vNightShader.textureModeList[2] = #wrapPlanar
pNightSphere = pMember.newModel("NIGHT MODEL",
vNightModelResource)
pNightSphere.shaderList[1] = vNightShader
pNightSphere.parent = pEarthSphere
end
on exitFrame(me)
pEarthSphere.rotate(0.0,0.1,0.0)
me.moveMaskNightTexture()
end
on moveMaskNightTexture(me)
vRotationVector = - pEarthSphere.transform.rotation
pNightSphere.shaderList[1].wrapTransformList[2].rotation =
vRotationVector
end
Maybe you are looking for
-
Issue in N level workflow of shopping cart
Hi all, SRM5.0 and ECC5, using ECS scenario We are using the N level workflow ( SC approval workflow and not item level workflow) with the BADI for determining the approvers of the shopping cart. The following are issues faced during rejection: 1. Wh
-
Automate RPD and Catalog Patching in OBIEE 11G
Is it possible to automate the patching process with scripting? This would be the complete cycle: compare, generate xml patch and apply patch. I see that I can script the applying of the patch but need to be able to script the compare.
-
Dynamic selection in program RFBILA00
Hi! can any one tell how to add fields at document level ( for example trading partner in document) in dynamic selection of program RFBILA00. Is there any relevant SAP notes? regs, ramesh B
-
Error ora-604 ora-904 invalid column name
Someone knows how to fix this problem? Error ora-604 ora-904 invalid column name.
-
IDVD 08...Encoding Options
I am confused. I am using iDVD 08 to burn a dvd and I am unsure of which Encoding I should use. I want the best possible dvd quality. But the amount of space the video uses up with each setting doesn't make since. "best performance" = 6.81 GB "high q