Problem with loading an image via HTTP
Hallo,
When using the JBCL TransparentImage control i can load images
from my local HD. But when i use setImageURL it won't work. I
looked at the sources and it seems to me that the problem lies
within the default toolkit. The following code works when using
a local file. Via HTTP the Observer get's one notification with
just the error-flag set.
URL url=new URL("http://localhost/mxtj_inetmaps/mp_map1.gif");
// String sFileName="c:\\mapinfo\\inetmap\\mp_map1.gif";
Toolkit tk=Toolkit.getDefaultToolkit();
Image i=tk.getImage(url);
// Image i=tk.getImage(sFileName);
MyObserver mo=new MyObserver();
tk.prepareImage(i, -1, -1, mo);
Could someone help me, how to show a Web-Image within a control ?
Bye Heiko.
null
Hi,
There is no getImage that accepts the parameters in the order in which you have given them. Try this:
getImage( getCodeBase(), "flower.gif" );
Regards,
Manfred.
Similar Messages
-
Help with loading multiple images via LoadVars
Hello everybody.
I need a hand loading multiple images using the LoadVars
method with a text file. I can get it to load 1 image but not
anymore than that. I am aware of other methods like using
components but I am looking for a method where I can access and
change all data from 1 text file (there will be text variable text
within the file aswell to, but I am more concerned with the images
at the moment).
Anyway on to the issue. I have created a much simple .fla
file that outlines my problem.
The movie contains 3 layers:
- top layer contains AS
- middle layer contains an empty movie clip with the
instance name of mcImage1
- bottom layer contains an empy movie clip with the instance
name of mcImage2
The AS layer contains the following code:
imagedata = new LoadVars()
imagedata.load("data.txt")
imagedata.onLoad = function(ok){
if(ok){
mcImage1.loadMovie(this.Image1)
mcImage2.loadMovie(this.Image2)
} else trace("Problem Loading")
In the same folder of my .swf file I have a text file called
data.txt which contains the following
&Image1=image1.gif
&Image2=image2.gif
Also in the same folder of my .swf file I have two images
image1.gif and image2.gif.
When I run the flash the image2.gif is imported correctly.
image1.gif does not appear.
You can download my source files and all images here
http://www.myrealpage.com/projects/var_test/var_test.zip
Any help that can be shed on this problem is much
appreciated.
Thanks
MattGlad to help. It is just that I see so many folks who have
two different parts of a problem smushed together – each
problem isn't so hard on its own, but together they are difficult
to wrap your head around. Always try and break down each step of
the problem and it will help you in the end.
That being said, I'm not quite so sure on this next problem.
I don't do so much timeline stuff along with the Actionscript. I
can get tricky. So this I don't quite have as much of clear mental
picture of what you are describing. But here are some questions
that I would ask – either of myself if I was doing it or of
you.
Is there a stop() on frame one to wait for the
LoadVars.onLoad? Does the onLoad then say to play?
If not, what happens if we get to Frame 10 before the
LoadVars has even finished? That could be a problem.
Remember that the LoadVars object is an actual object that
will exist until it is deleted or removed in various ways. You can
access it at any time after it is loaded. The onLoad event handler
is just that thing you want to happen immediately after it is
loaded.
So my design would probably be.
LoadVars on Frame 1.
Where I am stopped.
In the onLoad handler load the first image and tell the
timeline to play
On frame 10, the LoadVars object will still exist (unless
you've deleted it)
Get the variable out of the LoadVars and load the image.
If you want to check this. Put a stop() in frame 10 and run
it in the testing environment. When it gets to that frame, go to
the debug menu and List Variables. You should see that your
LoadVars object is still there.
Does that answer your question or am I totally missing the
point? -
Problem with loading big image files in 1.4
Hi, I recently discovered that after updating my jdk from 1.3 to 1.4, my application seems to be failing to display image files over 300kbytes, or at least the display is corrupted.
Originally I have a gif file over 300k (2048X512 pixels) and the display got corrupted, but when i reduced the file (1024X512) the display did not corrupt.
Is there any way other than to cut the filesize of the image??
~JeffreyI know that focus management has changed alot.
Based on my experimentation a while back, in 1.4 it still believes that the JFrame is the window in focus, even though a JOptionPane is currently in front of it (unless I misinterpreted what was going on). Thus, the frame seems to get the keyboard event and re-invoke the action.
A.F. -
I have a problem with loading the PNG image
I have a problem with loading the PNG image from site. For ex. go to icefilms com and is starts to load png like crazy CPU is huge and you can not shut down Firefox at least a minute. This is not just in this site but whit any one whit lots of pictures.
Image from firefox: Picture [http://img836.imageshack.us/img836/9910/7312011103147pm.jpg 1] [http://img28.imageshack.us/img28/8505/7312011103249pm.jpg 2] [http://img706.imageshack.us/img706/5615/7312011103348pm.jpg 3 ][http://img827.imageshack.us/img827/8483/7312011103533pm.jpg 4]
This is my Task Manager [http://img217.imageshack.us/img217/5715/7312011103621pm.jpg 1]
- I try safe mode, same thing
-All addons and plugins are ok
Any idea why is this so big problem.i did both of them, but still the while sending the mail the diolog box is not showing up and also the spelling and grammer does not do the spelling check.
This problem just started for about 3 to 4 days now. earlier it was working normally. -
Problem with Loading Images?
<pre><i>Locking duplicate thread.
Please continue here: [[/questions/982030]]
</i></pre>
Hi,
I'm using Firefox 26.0 and I'm kinda new user to Firefox.
I'm having this random issue with facebook (sometimes with other websites too),
Sometimes when I open a page, the Images doesn't show as usual.
Sometimes it takes up to 10sec - 2 mnts to finish loading all the images.
My internet is 8Mbps so I don't think its due to that?
Here is a screenshot of the exact issue: http://i.imgur.com/I3eOQaI.jpg
But it get fixed for a while (say 1-2 days) if I clear the cookies and caches. I visits a lot of webpages so clearing cookies and caches all the times is kinda not pretty possible.
I also tried disabling all my add-ons, and ran a full scan with McAfee.
Can anyone tells me what exactly could be the issue? It gets pretty annoying sometimes!
Thanks in advance!
Regards,
Abey'''Hi, Thanks for Visiting this Question. But it was a duplicate of https://support.mozilla.org/en-US/questions/982030 (The Same question) Accidentally posted twice''' and I couldn't find an option to delete it, so please '''ignore''' this :-)
Original thread: [[https://support.mozilla.org/en-US/questions/982030|"Problem with Loading Images"]]
Warm Regards,
Abey -
Problem with loading image to Applet.
Hello. Im preety new to Java, and currently ive got problems with adding an image to my applet. I tried to make game, similar to Mario - a platform based one. I found a source code of something close to that, and wanted to test but i couldnt get images loading. Here's the code :
Main class :
package pl.wat.edu;
import java.applet.*;
import java.awt.*;
public class Main extends Applet implements Runnable{
Thread th;
private final int speed = 15;
private Level obecny_poziom;
private Image dbImage;
private Graphics dbg;
MediaTracker mt = new MediaTracker(this);
private Image ziemia1;
@Override
public void destroy() {
// TODO Auto-generated method stub
super.destroy();
@Override
public void init() {
// TODO Auto-generated method stub
super.init();
setSize(stale.wielkosc_apletu_szerokosc, stale.wielkosc_apletu_wysokosc);
//setBackground(Color.blue);
//ziemia1 = getImage(getCodeBase(), "g1.GIF");
obecny_poziom = new Pierwszy(this, this);
@Override
public void start() {
// TODO Auto-generated method stub
super.start();
// create new thread
th = new Thread (this);
// start thread
th.start ();
@Override
public void stop() {
// TODO Auto-generated method stub
super.stop();
// Thread stop
th.stop();
th = null;
public void run() {
// TODO Auto-generated method stub
while (true){
repaint();
try
Thread.sleep(speed);
catch (InterruptedException ex)
// do nothing
@Override
public void paint(Graphics arg0) {
// TODO Auto-generated method stub
super.paint(arg0);
//arg0.drawImage(ziemia1,10,10,this);
obecny_poziom.paintLevel(arg0);
public void update (Graphics g)
if (dbImage == null)
dbImage = createImage (this.getSize().width, this.getSize().height);
dbg = dbImage.getGraphics ();
dbg.setColor (getBackground ());
dbg.fillRect (0, 0, this.getSize().width, this.getSize().height);
dbg.setColor (getForeground());
paint(dbg);
g.drawImage (dbImage, 0, 0, this);
}and Level class that have draw levels from String rows :
package pl.wat.edu;
import java.applet.Applet;
import java.awt.*;
public abstract class Level {
//private LevelElement [] elements;
private WorldTile [] tiles;
private WorldTile[][] tablica_kolizji;
private Color [] colors;
private Component parent;
private int lewa_granica;
private int prawa_granica;
private int dlugosclevelu;
private Image ziemia = null;
private Image titi;
private Applet applet;
public abstract void resetLevel();
public Level(Component parent, Applet applet) {
super();
this.parent = parent;
this.applet = applet;
ziemia = applet.getImage(applet.getCodeBase(), "g1.GIF");
public void initializeLevel(String [] definitions){
tablica_kolizji = new WorldTile [stale.dlugosclevela] [definitions[0].length()];
lewa_granica = 0;
prawa_granica = stale.wielkosc_apletu_szerokosc;
int licznik_kratek = 0;
for(int i=0; i<definitions.length; i++){
char [] definition_line = definitions.toCharArray();
for(int j=0; j<definition_line.length; j++){
if (definition_line[j] == ':')
tablica_kolizji[i][j] = null;
else if (definition_line[j]== 'g'){
Ziemia tile = new Ziemia(j*stale.szerokoscTile, i*stale.wysokoscTile, stale.ziemia_id, ziemia, parent);
tablica_kolizji[i][j] = tile;
licznik_kratek = 0;
tiles = new WorldTile [licznik_kratek];
int licznik = 0;
for (int i = 0; i<tablica_kolizji.length; i++){
for(int j=0; j>tablica_kolizji[i].length; j++){
if (tablica_kolizji[i][j] != null){
tiles[licznik] = tablica_kolizji[i][j];
licznik++;
public void paintLevel(Graphics g)
try
// draw background
// draw all elements in elements array
for(int i=0; i<tiles.length; i++)
tiles[i].rysujTile(g);
catch(Exception ex)
// do nothing
Any ideas why this Image doesnt show up ?michali7x4s1 wrote:
Thats a code i found somewhere, tried to check how some things work.Have you used exceptions before? If not, please read the sun tutorial on them as they are very very important. Also, whether this is your code or someone else's doesn't matter as it's yours now, and you would be best served by never throwing out exceptions as is done in this code. It's like driving with a blindfold on and then wondering why you struck the tree. It's always best to go through the tutorials to understand code before using it. If it were my project, I'd do it in Swing, not AWT. Fortunately Sun has a great tutorial on how to code in Swing, and I suggest you head there as well. Best of luck. -
Problem with displaying BLOB images on JSP page using a servlet
hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
here is one of my image servlet's working versions (the essential part of it) :
BLOB blob=null;
rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
while (rset.next())
blob=((OracleResultSet)rset).getBLOB(2);
response.reset();
response.setContentType("image/jpeg");
response.addHeader("Content-Disposition","filename=42.jpeg");
ServletOutputStream ostr=response.getOutputStream();
InputStream istr=blob.getBinaryStream(1L);
int size=blob.getBufferSize();
int len=-1;
byte[] buff = new byte[size];
while ((len=istr.read( buff ))!=-1 ) {
ostr.write(buff,0,len);
response.flushBuffer();
ostr.close(); and my JSP page code :
<img src="/ImageServlet" border="0" > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
here's the magic tag : <img src="ImageJSP.jsp" border="0" > enjoy : ) -
Memory leak problems with loading videos over and over.
I'm having memory leak problems with loading videos into a VideoPlayer aswell as FLVPlayback.
What the flash should do:
- Should be running for 7 days without having to restart the projector.
- Interface that shows people around a 360 3D model with 5 different parts and at the stops it makes during the rotation you can click to zoom in on a location which plays a movie for that aswell.
- Shows a video out of 5 parts for a 360 rotation in 3D in mp4 video (added each time and cleaned up, see code below).
- Still images are used when the video clips are done playing (MovieClip in stage).
- Should run automatically when there is no user interaction for X minutes.
What the problem is:
- The flash (as a exe and swf i guess) starts to consume memory over time (say 10 hours) until the projector crashes. This usually at around 1.75 GB of memory.
I cannot see why the Flash cannot garbage collect this and free up the memory. Mabye there is something I don't understand about the garbage collection in flash?
Here is some code from the video loading and playing:
var fVideo:VideoPlayer;
VideoCreate();
function VideoReady(pEvent:VideoEvent):void
trace("VideoReady()");
// start playing video
fVideo.play();
function VideoLoad(pUrl:String):void
trace("VideoLoad(" + pUrl +
VideoCreate();
if (pUrl != "")
if (fVideoFolder + pUrl == fVideo.source)
fVideo.seek(0);
VideoReady(null);
} else {
trace(fVideo.state);
if (fVideo.state !=
VideoState.DISCONNECTED) fVideo.stop();
fVideo.close();
fVideo.load(fVideoFolder + pUrl);
} else {
// error no url
function VideoCreate():void
trace("VideoCreate()");
// remove old one
if (getChildAt(0) == fVideo)
removeChildAt(0);
fVideo = new
VideoPlayer(1024, 768);
addChildAt(fVideo, 0);
fVideo.autoRewind = false;
fVideo.addEventListener(VideoEvent.COMPLETE, VideoDonePlaying);
fVideo.addEventListener(VideoEvent.READY, VideoReady);Hmm. It's in connection with Dropbox. Så apparantly you can only use one of the two at the same time if you want the programs integrated in Finder.
-
Please help us, we have a problem with loading a page is slow we have to wait a longer time to open our one page, thanks in advance
You can try these steps in case of issues with web pages:
You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
*Hold down the Shift key and left-click the Reload button
*Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
*Press "Command + Shift + R" (Mac)
Clear the cache and cookies only from websites that cause problems.
"Clear the Cache":
*Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
"Remove Cookies" from sites causing problems:
*Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"
Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
*Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
*Do NOT click the Reset button on the Safe Mode start window
*https://support.mozilla.org/kb/Safe+Mode
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes -
Has anyone experience problems with loading the latest Flash Play?
Has anyone experienced problems with loading the latest Flash Player? I have done this several times and the same results come up - Install the latest Flash Player. I run Microsoft Vista.
What is your browser? If IE see
http://forums.adobe.com/thread/885448
http://forums.adobe.com/thread/867968 -
Problems with loading native library/missing methods: no ttJdbcCS1121
Hi guys,
Im getting this problem in glassfish 2.1, but in glassfish 3 or in tomcat, i dont get this problem. (Windows)
Any thoughts?
java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbcCS1121 in java.library.path
at com.timesten.jdbc.JdbcOdbcConnection.connect(JdbcOdbcConnection.java:1750)
at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:305)
at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:161)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at com.summitinvt.mdaq.db.handler.DBConnector.getConnection(DBConnector.java:108)
at com.summitinvt.mdaq.db.handler.DBConnector.initiateConnection(DBConnector.java:101)
at com.summitinvt.mdaq.db.handler.DBConnector.<init>(DBConnector.java:34)
at com.summitinvt.mdaq.db.handler.DBConnector.<init>(DBConnector.java:14)
at com.summitinvt.mdaq.db.handler.DBConnector$DBConnectorUtil.<clinit>(DBConnector.java:24)
at com.summitinvt.mdaq.db.handler.DBConnector.getInstance(DBConnector.java:28)
at com.summitinvt.mdaq.rats.server.CommunicatorImpl.getPnLByCurrency(CommunicatorImpl.java:1074)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:207)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
regards
JohnA similar problem was reported before on this Forum - see
Re: not able create connection to timesten
checking the Release Notes I can see 11.2.1.8.0 has been tested against Glassfish 3 but I
can't see any mention about Glassfish 2 in the v7 or v11 Release Notes (albeit only on a quick
search).
In my full install on XP, ttJdbcCS1121.dll is in C:\TimesTen\tt1121_32\bin -
Problems with loading Facebook log in page.
Hello. I have problems with loading the Facebook log in page. It's been a day. Every time I try to go to the website, it reads,
"The connection was reset
The connection to the server was reset while the page was loading.
The site could be temporarily unavailable or too busy. Try again in a few
moments.
If you are unable to load any pages, check your computer's network
connection.
If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web."
I did every possible step to overcome the problem but in vain. Please suggest something that could work.....:(Hi,
Please also try to '''Clear Now''' the '''Cache''', '''Cookies''', and '''Site Preferences''' in '''Tools''' ('''Alt''' + '''T''') > [https://support.mozilla.org/en-US/kb/Clear%20Recent%20History Clear Recent History]. You can also open the '''History''' library ('''Alt '''+ '''S''') > '''Show All History''', search for facebook on the top right search box, right-click a facebook .com entry > '''Forget about this site'''.
[https://support.mozilla.org/en-US/kb/firefox-cant-load-websites-other-browsers-can?redirectlocale=en-US&redirectslug=Firefox+cannot+load+websites+but+other+programs+can Firefox can't load website] -
Problem in Loading Multiple image in Single Sprite/MovieClip
Hi All,
I am having a killing problem in loading multiple images in single movie clip/sprite using a separate class.
Here is the ImageLoader.as class
package com.project.utils{
import com.project.*;
import com.project.utils.*;
import flash.events.EventDispatcher;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.display.Loader;
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.display.Bitmap;
public class ImageLoader extends EventDispatcher {
public var imgloader:Loader;
public var imgMc:MovieClip;
public var imgObject:Object;
public var loaded:Number;
public function ImageLoader():void {
imgMc = new MovieClip();
imgObject = new Object();
imgloader = new Loader();
public function loadImage(imgHolder:MovieClip, imgObj:Object):void {
imgMc = new MovieClip();
imgObject = new Object();
imgloader = new Loader();
imgMc = imgHolder;
imgObject = imgObj;
imgloader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImgLoad);
imgloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onImgLoadProgress);
imgloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,onImageLoadFailed);
imgloader.load(new URLRequest(imgObj.FilePath));
private function onImgLoad(Evt:Event):void {
var image:Bitmap = Bitmap(Evt.target.content);
try {
imgMc.removeChildAt(0);
} catch (error:Error) {
imgMc.addChild(image);
try {
if (imgObject.URL != undefined) {
imgMc.buttonMode = true;
imgMc.removeEventListener(MouseEvent.CLICK, onImageClicked);
imgMc.addEventListener(MouseEvent.CLICK, onImageClicked);
} catch (err:Error) {
dispatchEvent(new CustomEvent("CustomEvent.ON_IMGE_LOAD"));
private function onImageClicked(evt:MouseEvent):void {
trace("Image Attrs:"+imgObject.URL +" Target "+imgObject.Target);
private function onImgLoadProgress(Evt:ProgressEvent):void {
if (Evt.bytesLoaded>0) {
loaded = Math.floor((Evt.bytesLoaded*100)/Evt.bytesTotal);
dispatchEvent(new CustomEvent("CustomEvent.ON_IMGE_LOAD_PROC",loaded));
private function onImageLoadFailed(Evt:IOErrorEvent):void {
trace("Image Loading Failed");
dispatchEvent(new CustomEvent("CustomEvent.ON_IMGE_LOAD_FAIL"));
Here I am loading some images using the above class in a for loop, like
for (var i=0; i < 3; i++) {
//imgLoader=new ImageLoader;
imgLoader.addEventListener("CustomEvent.ON_IMGE_LOAD",onImageLoad);
var target:MovieClip=videolist_mc["list" + mcCount + "_mc"];
target.list_mc.visible=false;
var imgObj:Object=new Object;
imgObj.FilePath=list[i].Thumbnail;
imgObj.Url=list[i].Url;
imgObj.Target=list[i].Target;
target.list_mc.urlObj=new Object ;
target.list_mc.urlObj=imgObj;
imgLoader.loadImage(target.list_mc.imgholder_mc,imgObj);
target.list_mc.lable_txt.htmlText="<b>" + list[i].Label + "</b>";
target.list_mc.imgholder_mc.buttonMode=true;
target.list_mc.imgholder_mc.addEventListener(MouseEvent.CLICK,onItemPressed);
mcCount++;
In this case, the ImageLoader.as works only on the last movie clip from the for loop. For example, if i am trying to load three image in three movie clips namely img_mc1,img_mc2 and img_mc3 using the for loop and ImageLoader.as, I am getting the image loaded in the third movie clip only img_mc.
See at the same time, If i uncomment onething in the for loop that is
//imgLoader=new ImageLoader;
its working like a charm. But I know creating class objects in a for loop is not a good idea and also its causes some other problems in my application.
So, help to get rid out of this problem.
Thanks
-Varunpackage com.project.utils{
import com.project.*;
import com.project.utils.*;
import flash.events.EventDispatcher;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.display.Loader;
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.display.Bitmap;
public class ImageLoader extends EventDispatcher {
public var imgloader:Loader;
public var imgMc:MovieClip;
public var imgObject:Object;
public var loaded:Number;
public function ImageLoader():void {
// better add you movieclip to the stage if you want to view anything added to it.
imgMc = new MovieClip();
imgObject = new Object();
imgloader = new Loader();
public function loadImage(filepath:String):void {
imgloader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImgLoad);
imgloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onImgLoadPr ogress);
imgloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,onImageLoadF ailed);
imgloader.load(new URLRequest(filepath));
private function onImgLoad(Evt:Event):void {
var image:Bitmap = Bitmap(Evt.target.content);
try {
imgMc.removeChildAt(0);
} catch (error:Error) {
imgMc.addChild(image);
try {
if (imgObject.URL != undefined) {
imgMc.buttonMode = true;
imgMc.removeEventListener(MouseEvent.CLICK, onImageClicked);
imgMc.addEventListener(MouseEvent.CLICK, onImageClicked);
} catch (err:Error) {
dispatchEvent(new CustomEvent("CustomEvent.ON_IMGE_LOAD"));
private function onImageClicked(evt:MouseEvent):void {
trace("Image Attrs:"+imgObject.URL +" Target "+imgObject.Target);
private function onImgLoadProgress(Evt:ProgressEvent):void {
if (Evt.bytesLoaded>0) {
loaded = Math.floor((Evt.bytesLoaded*100)/Evt.bytesTotal);
dispatchEvent(new CustomEvent("CustomEvent.ON_IMGE_LOAD_PROC",loaded));
private function onImageLoadFailed(Evt:IOErrorEvent):void {
trace("Image Loading Failed");
dispatchEvent(new CustomEvent("CustomEvent.ON_IMGE_LOAD_FAIL"));
Here I am loading some images using the above class in a for loop, like
for (var i=0; i < 3; i++) {
var imgLoader:ImageLoader=new ImageLoader();
imgLoader.addEventListener("CustomEvent.ON_IMGE_LOAD",onImageLoad);
var target:MovieClip=videolist_mc["list" + mcCount + "_mc"];
target.list_mc.visible=false;
var imgObj:Object=new Object;
imgObj.FilePath=list[i].Thumbnail;
imgObj.Url=list[i].Url;
imgObj.Target=list[i].Target;
target.list_mc.urlObj=new Object ;
target.list_mc.urlObj=imgObj;
imgLoader.loadImage(pass the image file's path/name);
target.list_mc.lable_txt.htmlText="<b>" + list[i].Label + "</b>";
target.list_mc.imgholder_mc.buttonMode=true;
target.list_mc.imgholder_mc.addEventListener(MouseEvent.CLICK,onItemPressed);
mcCount++; -
Beginner Has Problem With Loading JDBC Driver Using MySQL
Hi, I am having problem with loading JDBC driver, and need your diagnotic help.
1. I have installed MySQL (C:\mysql), created a databse (soup), and created a littel table (VIDEOS). I am able to see the table in the console:
sql> select * from videos
2. I have downloaded the latest version of Connector/J (mysql-connector-java-3.1.0-alpha.zip), and unzip the zip file into my C:\ directory.
3. I copied the mysql-connector-java-3.1.0-alpha-bin.jar to the C:\j2sdk1.4.1_02\jre\lib\ext folder and it is in my CLASSPATH
4. MySQL server is running
C:\> C:\mysql\bin\mysqld-nt --standalone
5. open another DOS window and use the database
mysql>USE SOUP
6. succesfully compiled a Java program (javac Test.java):
import java.sql.* ;
public class Test
public static void main( String[] args )
try
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
try
Connection con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/soup" );
try
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT TITLE FROM VIDEOS");
while ( rs.next() )
System.out.println( rs.getString( "TITLE" ) );
rs.close();
statement.close();
catch ( SQLException e )
System.out.println( "JDBC error: " + e );
finally
con.close();
catch( SQLException e )
System.out.println( "could not get JDBC connection: " + e );
catch( Exception e )
System.out.println( "could not load JDBC driver: " + e );
7. when I run the Java program (java Test), I got
the message:
could not load JDBC driver: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
What am I missing?Hi,
I missed to specify test in my last post.
Try running your program by explicitly setting the classspath when
running your program . java -classpath c:\mysql-connector-java-3.1.0-alpha-bin.jar test
Make sure your jar file contains org.gjt.mm.mysql.Driver class -
DW CS3 problem with PNG-8 images in Design View?
DW CS3 (build 3481) on XP seems to have problems with PNG-8 images, specifically trying to display them in design view.
I had a very simple image that was able to be exported by Fireworks CS4 as PNG-8 using 4 colors (no transparency) for a tiny file size under 250 bytes.
DW could not display it at all, or even recognize it, reporting it was 0 x 0 in size. I published the page anyway, and it looked fine in the browser.
I upped the number of colors to 32, and DW could then display it in design view in the page I was working on.
I'm still having problems with other PNG-8 images. The attached file "temp.jpg" is a screenshot showing part of the design view in DW.
The smaller image on the left of the banner is "58_certificate_of_discharge.png" (attached), and the larger image below is used as the background of the DIV containing the form,"compassbk.png" (also attached).
These images all look fine in the browser, but terrible in DW.
I'm stumped as to why.
Thanks in advance.According to a different discussion, the images that are stuck as "Queued" are showing a bug in the virus scanning on the forums.
Now trying the recommended 'camera icon' method...
Looks like it worked.
Now compare what it looks like in DW CS3 in the design view:
It's a 16 color PNG-8 made in Fireworks CS4 with no transparency, size is 113 x 58, ending up at 1.71K.
If this is a repeatable problem in CS3, is there any hope of it being resolved, or am I stuck with upgrading to CS4 as my only option (assuming it's fixed in CS4)?
Thanks.
Maybe you are looking for
-
Problems with Mail after Upgrading to Lion
I recently upgraded from Snow Leopard to Lion (which is the most updated OS my Mac can run) Now Mail doesn't recognise my me.com password and I can't send or receive emails from my me.com account on the upgraded Mac - although the iCloud account emai
-
BATCH_SCHEDULING_FAILED
Dear Experts, Am doing the upgrade of SOLMAN from 3.1 to 7.0 EHP1. In pre-processing, got an error in RUN_RSPTBFIL_DEST as Batch sceduleing failed. Checks after phase MAIN_SHDRUN/RUN_RSPTBFIL_DEST were negative! 4 ETQ359 RFC Login to: System="SMR", N
-
Adobe Flash Player for Samsung tablet?
I recently purchased Samsung tablet. I need to take some courses that require Adobe Flash Player. When I tried downloading the file I received an error message saying my device doesn't support the file. I tried downloading the app with no luck. Is
-
Steps to create a new Oracle Application server
I am in unfamiliar territory and need to create a new Oracle Application Server. I would appreciate any direction or direction to documentation that explains the steps required to establish a new server. Thanks.
-
I have CS4 (have had it since it came out) and recently removed both cs2 & 3 as they hadn't been used in probably 5-8 years and I needed the space on my harddrive. Now when I open any artwork in InDesign I get this error ............"indd is not a v