Unable to load external images in flash
Hi,
I am a beginner in flash programming. I am trying to write a small flash app which will load and display images provided as a query.
My flash app works fine when I provide the image path directly in the browser address bar, but it is not working when I do the same using html.
Here is the direct link to the flash app:http://srbose.freelinuxhost.co.cc/test/lesson2.swf?photo=http://www.flash-mx.com/images/im age1.jpg
Here is the link to the html with which I am trying to invoke the app.
http://srbose.freelinuxhost.co.cc/test/lesson2.html
The Html code is attached with the post.
I know my app is getting invoked and it appears to work fine when I hardcode the image url into the flash app. But the query method just does not seem to be working!!
This is hosted on a linux site supporting php.
I have really hit a stone wall here as far as debugging this goes. Any help will be really welcome. Thanks in advance, srb.
I got my answer. I had to append the photo url to the 'movie' value of the javascript embed method. Like this:
<script language="JavaScript" type="text/javascript">
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
'width', '550',
'height', '400',
'src', 'lesson2',
'quality', 'high',
'pluginspage', 'http://www.adobe.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'lesson2',
'bgcolor', '#ffffff',
'name', 'lesson2',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','always',
'movie', 'lesson2?photo=http://www.flash-mx.com/images/image1.jpg',
'salign', ''
); //end AC code
</script>
Thanks,
srb.
Similar Messages
-
Unable to load external image into iOS app with AS3
Just trying out Flash Builder for iOS app development and have run into a problem right off the bat with loading an external image into an iOS app. The actionscript is very simple (this was basically my Hello World attempt), and I'm hoping someone here can explain where I'm going wrong. This code works in Flash Pro, and works when launched on the desktop from Flash Builder, but doesn't work on my iOS devices.
Here's the code:
var container:MovieClip = new MovieClip();
addChild(container);
var imageLoader:Loader = new Loader();
imageLoader.load(new URLRequest("http://www.google.ca/intl/en_ALL/images/logos/images_logo_lg.gif"));
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, startListener);
function startListener (e:Event):void{
container.addChild(imageLoader);
Any thoughts on why this won't work would be greatly appreciated!I had the same issue, and modified my domain policy file as specified in http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html#_Configuring_URL_M eta-Policies but the loader is not loading the file. Any ideas on how to fix this issue?
-
Load external images and video in edge
Hi.
I am looking into edge instead of flash.
My question is how do you load external images and videos from an external server?
To clarify, I need to insert a link from where the images can load into the stage, so they don´t take up any of the final weight.
Thanks in advance.
Best,
Stig.The above solution I provided works if you already have the images in your composition and than if you want form load images from another server rather than the relative location to your html file.
Now if you want to load images dynamically into a rectagle containter you will have to code it.
below is a sample for that
Create a 'rectangle' with name 'Rectagle'.
Add the snippet in the compositon ready or on other user actiosn based on your requirement
var myImagetag = '<img src="http://wwwimages.adobe.com/include/style/default/SiteHeader/logo-2x.png">'
sym.$("Rectangle").append(myImagetag); -
Load external jpeg into flash movie
Hi, how do i load external jpeg into flash movie?
Can someone show me the actionscript? Thankshi, i pasted the code on a mc but it didn't work.
However, when i put in on frame action, it works.
However, i realised the image flickered (more like refreshed)
after afew sec...
Is this normal? Is it the loop problem? how do i get rid of
that? -
Loading External Images Causes Memory Leak
I have been working on an Actionscript 2.0 project that basically loads external images.
Everytime i load and unload a new image, memory increases to 1 or 2 MBs
If all the images are in cache, then it increased to 4 or 8 KBs
In the unloading of images, I have removed loader and the container of the image.
Any thoughts why it is behaving like that?
Please find the sample code snippet below.
btn_load.onRelease = function()
loadImage();
btn_unLoad.onRelease = function()
unLoadImage();
var mcListener:Object = new Object();
var container1:MovieClip;
var mcLoader:MovieClipLoader;
var loader_reference = this;
var n=0;
function loadImage(){
var image_arr = ["http://xyz.com/image1.png","http://xyz.com/image2.png","http://xyz.com/image3.png","http:/ /xyz.com/image4.png","http://xyz.com/image5.png"];
var image_url = image_arr[n];
if(n==image_arr.length-1) {
n=0;
}else{
n++;
container1 = loader_reference.createEmptyMovieClip("container1", loader_reference.getNextHighestDepth());
mcLoader = new MovieClipLoader();
mcLoader.removeListener(mcListener);
mcLoader.addListener(mcListener);
mcListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
mcListener.onLoadInit = function(target_mc:MovieClip):Void {
target_mc._x = 300;
target_mc._y = 200;
target_mc._width = 300;
target_mc._height = 250;
mcLoader.loadClip(image_url, container1);
function unLoadImage(){
mcLoader.unloadClip(container1);
mcLoader = null;
container1 = null;
removeMovieClip(loader_reference.container1);
Thanks in advance.that code should only execute once. fix that.
-
Im wanting to make a photo gallery that I can update easy, I
thought if I could have a movieclip load external images for my
thumbnails it would be nice but Im not sure how to set it up. I
would make a file for my images and then another for my thumbnails,
then if or when I want to switch out pictures I'd just have to drop
new images into my folders and not even touch the FLA. Could anyone
point me in the right direction with the right action script to use
or a tutorial that explains how this is done..
And when I say load external I want it so I dont have to
click on the image for it to load, I want it to just load
automatically , I would put an invisible button or something to
that efect over the images for a animated effect.
Thanks for your help.I don't know if you are super enthusiastic about building it,
or if you just want the utility. If the later is the case, I just
purchased (cheap) a really great product that does all of what you
want, fairly automatically, including scaling large pictures down
to smaller size so that they load quickly.
I am not sure of the policy of recommending third-party
applicatons here. So, if you are interested, send an email (private
message) to me and I will show you the simple site I put together
using it and where to get it. -
Unable to load external swf which has runtime sharing with another swf.
Hi,
I am getting issues on loading external swf say "importer.swf" file into another swf file say "loader.swf" for second time like
ReferenceError: Error #1065: Variable testSymbol is not defined. VerifyError: Error #1014: Class testClass could not be found.
at global$init()
In the external swf "importer.swf", i am trying to import the symbol "testSymbol" from another swf file say "exporter.swf", which exports through runtime sharing option for the symbols.
I am having some buttons in loader.swf file and on each button click i am loading different swf files into the loader.swf after unloading the previous one.
I am able to load and unload different swf files but unable to load the importer.swf file which is sharing symbols from external swf and that too for the second time i.e., when i click the button twice.
When trying to debug with flash debugger, all the other swf files are being unloaded before loading of another swf but the swf which is sharing symbols/classes with another swf is not getting unloaded.
Output when i am trying to load two files example and importer files into loader.swf file on two different button clicks. On first button click example.swf is loaded. On second button click , example.swf is unloaded and importer.swf is loaded which is successful. On first button click again importer.swf is unloaded and example.swf is loaded. On second button click again, example.swf is unloaded and importer.swf is loaded, here i am getting issues shown above.
Attemping to launch and connect to Player using URL D:\runtime issue\loader.swf
[SWF] D:\runtime issue\ loader.swf - 8181 bytes after decompression
[SWF] D:\runtime issue\example.swf - 441708 bytes after decompression
[UnloadSWF] D:\runtime issue\example.swf
[SWF] D:\runtime issue\importer.swf - 1920 bytes after decompression
[SWF] D:\runtime issue\importer.swf - 441708 bytes after decompression
[SWF] D:\runtime issue\ example.swf - 441708 bytes after decompression
[UnloadSWF] D:\runtime issue\ example.swf
[SWF] D:\runtime issue\importer.swf - 1920 bytes after decompression
ReferenceError: Error #1065: Variable xxxxxx is not defined.
Debug session terminated.
Code i am using
b1.addEventListener(MouseEvent.CLICK, b1Clicked);
b2.addEventListener(MouseEvent.CLICK, b2Clicked);
var ldr:Loader;
function b2Clicked(e:MouseEvent)
if(ldr != null)
ldr.unloadAndStop(true);
ldr = new Loader();
ldr.load(new URLRequest("importer.swf"));
addChild(ldr);
function b1Clicked(e:MouseEvent)
if(ldr != null)
ldr.unloadAndStop(true);
ldr = new Loader();
ldr.load(new URLRequest("example.swf"));
addChild(ldr);
If i try to open the swf using IE, i am not getting any issues at all. But i need to open this loader.swf in a air application. Also when i use loaderContext for the loader instance i am able to get rid of this issue but i cant use it in my application.
So, please help me in resolving this issue.
ThanksI got my answer. I had to append the photo url to the 'movie' value of the javascript embed method. Like this:
<script language="JavaScript" type="text/javascript">
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
'width', '550',
'height', '400',
'src', 'lesson2',
'quality', 'high',
'pluginspage', 'http://www.adobe.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'lesson2',
'bgcolor', '#ffffff',
'name', 'lesson2',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','always',
'movie', 'lesson2?photo=http://www.flash-mx.com/images/image1.jpg',
'salign', ''
); //end AC code
</script>
Thanks,
srb. -
Best Practice - load external image including rollovers
I am attempting to use the loader component to load an
external jpg, but experience issues having my flash app
successfully load a roll-over image from an external source when
the user rolls over the intital jpg. I am not a flash developer
(actually a .net developer trying to help a graphics guy out).
I started with the loader component, converted it to a movie
clip and then utilized the on(rollover) and on(rollout) events to
change the loader component's contentPath property at runtime via
ActionScript. I am not getting consistent results with this
strategy - what is the best way to accomplish this? Also note I
tried converted to a button, which seemed more logical, but the
loader component doesn't seem to like being converted to a button.
Regards,
DaflookieDaflookie,
> I started with the loader component, converted it to a
movie
> clip and then utilized the on(rollover) and on(rollout)
events
> to change the loader component's contentPath property at
> runtime via ActionScript. I am not getting consistent
results
Check out the Loader class in the Components Language
Reference. Loader
extends MovieClip, so there's no need to convert to a movie
clip symbol. In
addition, I recommend scrapping on() in favor of MovieClip
events, which
will probably be closer to your .NET point of view that the
older
on/onClipEvent approach to event handling (those are Flash
5-era).
Honestly, though, if you simply want to load images, I would
forego the
Loader component (no need for all that overhead) and use
MovieClipLoader to
load your images into the user's Internet cache. You'll see a
good handful
of events under that class listing as well (see the
ActionScript 2.0
Language Reference).
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
FAQ: SWF's and loading external files in Flash Catalyst
How do I make the images in my Flash Catalyst project external to the published SWF?
You can choose whether images are embedded in your Flash Catalyst SWF, or loaded dynamically; this can help to keep your SWF's small. Simply right-click an image and chose "Externalize Image".
Answered by: Adam Cath.
See entire discussion.
How do I make the SWF I imported to Flash Catalyst load external files?
When importing a SWF, Flash Catalyst only pulls the SWF asset into your project. Many SWF's, such as slideshows and media players, rely on external data files, such as configuration files or media assets. If you would like to use such a SWF in Catalyst, then you will have to place these external resources into your Catalyst project as well as importing the SWF.
Let's assume you have a SWF source folder that contains your SWF file and all of the external files it needs. You can open the SWF file from this folder and it works fine. But, if you import the SWF into Catalyst, the Catalyst project doesn't display it correctly because it can't load the external files. Here's what you do:
1. Open your swf source folder, and copy all of the files/folders there except the SWF you imported.
2. In Catalyst, Run/Preview your project (Ctl/Cmd-Enter)
2. Note the file path to Main.html in your browser
3. In your OS, open the folder that contains /bin-debug/Main.html from above
4. Open the "src" folder
5. Paste all of the files from step 1 into the src folder.
6. Catalyst won't pick up that your project changed, so tweak it a bit (add a Rectangle), and save it.
7. Run your project. If it doesn't work, try closing and reopening your project and running again.
For an example, check out: Using an XML-driven SWF in Catalyst to create a slideshow.
See entire discussion.
Answered by: Bear TravisYou can make you swf a custom component with 2 states.
The first state will be empty and rename it "OFF" the second state will have your swf file and name it ON.
Then go back to your artboard/project, add your 2 buttons ON & OFF.
For the ON button add interaction "play transition to custom component ON"
For the OFF button add interaction "play transition to custom component OFF"
Here is an example swf_control -
Making a loaded external image into a button in Actionscript
My name is Steve Oatman I am a student at
AIO for a Web Design Diploma
class: Interactive Telecommunications IMD412 XA
Professors to bussy!
I have a flash web site that I am putting together. I am using AS to load some images from an external source. These images are being loaded into a movieclip. These images need to become buttons once they are loaded. The images will link to the particular menu category pages beef, chicken, etc.
The images are loading fine they just are not responding like a button or link.
I am getting two error referencing the buttonMode and usehandCursor. Below is just one image that I am working on till I get it to work.
I am getting these two Compiler error code:
1119: Access of possibly undefined property buttonMode through a reference with static type flash.display:Loader.
1119: Access of possibly undefined property useHandCursor through a reference with static type flash.display:Loader.
This is what I have.
var myLoader01:Loader = new Loader();
myLoader01.load(new URLRequest("entrees_images/beef/beef01.gif"));
addChild(myLoader01);
myLoader01.x = -269;
myLoader01.y = -164;
myLoader01.buttonMode = true;
myLoader01.useHandCursor = true;
myLoader01.addEventListener(MouseEvent.CLICK, beefClick);
function beefClick(event:MouseEvent):void{
gotoAndStop("beef");
From me searching online I thought the
name.buttonMode = true;
turned the element into a button!
I have included the fla file. This is in the menuItems_mc which is located in the pageContent_mc frame 40 layer page Image or of course the library.
I know this is a little in depth sorry and any help would be greatly appreciated.
Steve
713/742-3325Try something along the following lines:
var myLoader01:Loader = new Loader();
function addIt(evt:Event):void{
var aBtn:MovieClip = new MovieClip();
aBtn.x = -269;
aBtn.y = -164;
aBtn.buttonMode = true;
addChild(aBtn);
aBtn.addChild(myLoader01);
aBtn.addEventListener(MouseEvent.CLICK, beefClick);
myLoader01.contentLoaderInfo.addEventListener(Event.COMPLETE, addIt);
myLoader01.load(new URLRequest("entrees_images/beef/beef01.gif"));
function beefClick(event:MouseEvent):void{
gotoAndStop("beef"); -
Load external image and animate?
This may be a naive question, but -
What is the best method to draw external content (an image
file) into a Flash movie, AND then ANIMATE that content?
I assumed I would need to use the LOADER COMPONENT to draw an
image file from an external URL, but is there a way to then perform
a simple animation (e.g., slide the image across the stage) with
the loaded image? I cannot seem to figure out how to manipulate an
image once loaded (using the LOADER COMPONENT).
Yes, I am new to Flash, so there may be six other ways to do
this of which I am not aware.
Suggestions/solutions?use the MovieClipLoader class to load the image into a holder
movie clip, then use the onLoadInit function to animate the holder
clip. -
Load external image & text into SWF
Can someone point me to a tutorial on how to create a
template that will load an external image file,.css styled text
& a .css style sheet into a .swf by using .xml?
Thank you for your time.
CKYou can use the MovieClipLoader class to load multiple images sequentially (one at a time), but you wouldn't use a 'for' type of loop...instead you would use a recursive loop, where a loading function is called after each load completion until all loading in done. This is done by utilizing a load-complete listener to trigger loading of the next image. So you start the loading process by loading one file, when that file is determined to be loaded, the listener proceses that file in whatever way you need to prepared (resizing, etc) and triggers the loading of the next file.
If you look up the MovieClipLoader.addListener method in the Flash help documents there is an example there that uses the onLoadInit event. You would be wanting to use the onLoadComplete event. -
Unable to Load the images Required by Classroom in a Book
Just purchased Adobe Photoshop Elements 12. I am trying the follow the lessons in the above book. When I create the files and download the images, I am unable the import the files and images into the Photoshop Organizer. Some images will import but most just display a weird icon. I have reloaded, updated Windows, Photoshop, display drivers, you name it. Nothing works.
Using Windows 7 with 8 GBs of 64 bit memory.
I like the book, and feel it will be a great introduction to Photoshop. But if I can't load the images into the Photoshop 12 Organizer. I can't follow or use the book
Lou (tobytussah)Lou again.
As a follow up. I am also unable to reliability load any Images into the Organizer either by using the Organizer File find functions or totally unable to move images into the Organizer using the Windows Explorer.
Should the ask for help better belong in some other forum?
Lolu -
AS3 Load external image and add multiple instances to mcs
Hi,
Is there any way to load an external image and add it to more than one movie clip?
Thanks,
Chris McLaughlinHi kglad,
I was loading a larger jpeg to which I was applying 20 different masks so using the bitmapdata class to create duplicates was the best solution.
It took me some time to wrap my head around it, but all is well.
Thanks for pointing me in the right direction.
Best regards,
Chris -
Loading external Images in MovieClips
Dear All,
I am trying to load the external images in Dynamically
created Movie Clips.
Can you please help me out from this.
I am trying something like this:
Container_mc.image_mc ( I want to load the Images inside the
imag_mc clip)
Regards,
Sridhar B
Container_mc.image_mc
imag_mcHi,
Following is my problem:
I am trying to trace the "idValue" property on runtime but it
is showing error. Can you please tellme how add Images and
properties runtime.
var loader:Loader = new Loader()
addChild(loader)
loader.load(new URLRequest("images/01.png"))
// Assigning a value to idValue property
mc_mainSWF.idValue = 40
mc_mainSWF.addChild(loader)
mc_mainSWF.addEventListener(MouseEvent.CLICK, checkID)
function checkID(event:MouseEvent)
// And i am geeting error here
trace(event.target.idValue)
Regards,
Sridhar B
Maybe you are looking for
-
ARF converted to MP4 or WMV shows desktop which don't see in ARF
Hello, We are hoping to use WebEx to record training videos, and I was excited to see the "new" cability to convert ARF files to MP4 and WMV in a much easier way than the past and without the 'tinny' noise. Great job, Cisco! Can someone help with my
-
Adding a box(subform) to an existing table
Hi there, Just wondering if its possible to add a small box attached to the outside of a dynamic table.I want the box to be attached to the bottom right of the table approximatetly 1/5 of the width of the table.As the table expands the box will remai
-
Notification to be sent to all approvers in Portal
Hi, I have a requirement where, when a user is getting retired, all possible approvers for this process, should be notified in Portal and not SBWP. If I configure agents in the notification tab of an activity in the workflow, the agents are being not
-
How do I batch convert avi video to QT mov (using Sorenson3 codec) w/ QuickTimePRo7? Thanks!! PC Windows XP Pro Mind attached
-
HT5012 Unlock SIM card in iphone
Unlock my SIM card in my iPhone IMEI 013052003809171