Drawing static images in flash 8
Hello Community !
Does anyone here know what the steps and tools that are used
to draw static images in Flash 8? Once drawn I would like to import
them into Dreamweaver 8 nad Illustrator 8. Not to be used as a flah
movies of Jif or gif.
Any books you may know about and ofr videos would be great,
preferably "books" on the subject.
Thanks
ATj The Flow
Thanx Albee!
albee wrote:
> you need to define i explicitly:
>
>
>
> _root.createEmptyMovieClip("fundo",1);
> fundo.loadMovie("image3.jpg");
> var fotosArray:Array = ["image1.jpg", "image3.jpg",
"image7.jpg"];
> var i:Number = 0;
> function fotosRotativas() {
> i == 2 ? i = 0 : i++;
> loadMovie(fotosArray
, fundo);
> }
> setInterval(fotosRotativas,5000);
>
Similar Messages
-
Adobe Flash Media Live Encoder and static image or recorded video?
Is it possible to put a static image or a recorded video (instead of a live video feed) into Flash Media Live Encoder to air while broadcasting a live radio show online?
FMLE will work with all devices which have direct show based drivers and give data in raw format. Here is a list of devices which have been tested and certified with FMLE - http://www.adobe.com/support/documentation/en/flashmediaencoder/FMLE_DeviceMatrix3.0.pdf
-
Flash animation appearing as static image
I created a banner ad in Flash 8 and we have loaded it on our
site. Some people can see it and it works great, others only see
the first frame (it looks like a static image).
How can I fix this?Post url.
You may have the movie jumping to a location before it exists
(not loaded yet). Try preloading everything first, or like I said
post the url so we can check it out. -
Hello,
I basically want to have my php pages with flash swf objects to be smart enough to replace the flash swf's with static images or other content for the non-flash user (iphone, ipad, etc.) who visits the website. I guess this would be an option or perhaps a script that just sent the visitor to a version of the .php page that is tailored to them, a version of the page designed for non-flash users.
I've done a little bit of reading up and have found that some people like to use DOM scripts like
Unobtrusive Flash Objects (UFO) v3.22
or what seems to be the successor:
SWFObject 2.0
What is better? Is there a better script out there to use at this point? Advice would be much appreciated.I guess I will reiterate this.
I would like someone to tell me which one of these scripts that I have mentioned above would be best to use.
What am I trying to do? Well from my understanding these scripts allow me to have multiple versions of the website, so that it loads up with static images in place of the flash swf's for... NON FLASH USERS.
The script will be able to detect whether the flash capabilities of the browser are sufficient, and if not display the web page accordingly.
SO. I'm looking for an answer as to what is the best script to use, if it's not one of the scripts I am asking about.
@The Shocker.. if I wanted to research it on the net by googling, which I already have, I wouldn't be using this forum. I'm looking for someone who is knowledgeable in this area of expertise to give me a recommendation, based on information they can give me that is logical and clear. And then I can do further research once I feel I'm being sent in the right direction.
Thanks in advance to anyone who would like to offer me some direction on this. -
Displaying Static Image of a page in an application
Hi All,
Ultimately I'd like to design an app which displays a PDF, however I only really need a static image of the page... no toolbars, etc...
I've successfully written the app with the Adobe Reader ActiveX component, but there are a few things left to desire.
1. I can use setShowToolbar and setShowToolbar to disable them and get a fairly static view of the PDF (+/- the annoying tab bar on the left), however when it first renders the object, I see both the scroll bars and toolbars, then it flashes and removes the toolbar, then flashes again and removes the scrollbars. It doesn't seem to matter in what order I call loadFile, setShowToolbar, setShowToolbar... or the delay afterwards in which I wait to show the object. Any way to get rid of this?
2. I've tried toying with the IViewObject::Draw method with no luck what so ever. I've tried numerous ways in my WM_PAINT message of my window to call this method in hopes of a static rendering to appear. The method returns S_OK, but I get nadda. I've followed examples of using the IWebBrowser object in this way to get a static web page, other than the fact that I call loadFile in the IAxAcroShim object first to give it something to show... This is my first app using an ActiveX component, so any help here would be appreciated.
3. I noticed a lot of posts on how to remove the tab (nav) bar that appears on the right, and most peeps say "not possible". I tried the approach of finding the window by looking for "AVTabStripView", and just hiding it, and resizing the window with the doc in it to fill in the gap... works ok... The doc window being "AVPageView".Well, the ActiveX control is exactly what I want... to view a PDF in my app just the way it is. I was only trying to produce a static view to get rid of the annoying flashes that happen when the toolbar and scrollbars are disabled. I don't care that the user can re-enable them, or do what they want, I'm only showing it initially with the toolbar off since the window is small and I want to maximize the document in the window for the users benefit. So, perhaps "static" wasn't the best word for it.
The purpose of the app is simply to display Adobe Reader as a child window inside of a full-screen app so that the user doesn't need to alt-tab continuously to compare data. The parent app runs in full-screen, with no "windowed" mode available. I'm using ActiveX instead of the app directly so that the PDF can the displayed in a portion of the screen that makes sense. And all the PDFs being displayed are single page... i.e. displaying a manual for a game, from within the game, but the window itself is decorated to go with the game... -
I need help to draw an image and move it plz plz : )
Ok, so I have this whole code and I understand most of it but not all of it but I'm trying to make image "drop.gif" to move down the right side of the window. For each shot that is taken the image moves down ever so much and if the image hits the Entity ship "background" than notify death. PLease anyone help me !
there are 7 classes but here is the main ...
package spaceinvaderss;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferStrategy;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Main extends Canvas {
/*A Canvas component represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user.
An application must subclass the Canvas class in order to get useful functionality such as creating a custom component.
The paint method must be overridden in order to perform custom graphics on the canvas.*/
/** The stragey that allows us to use accelerate page flipping.*/
private BufferStrategy strategy;
/** True if the game is currently "running", i.e. the game loop is looping */
private boolean gameRunning = true;
/** The list of all the entities that exist in our game */
private ArrayList entities = new ArrayList();
/** The list of entities that need to be removed from the game this loop */
private ArrayList removeList = new ArrayList();
/** The entity representing the player */
private Entity ship;
/** The entity representing the alien */
private Entity alien;
/** The speed at which the player's ship should move (pixels/sec) */
private double moveSpeed = 600;
/** The time at which last fired a shot */
private long lastFire = 0;
/** The interval between our players shot (ms) */
private long firingInterval = 400;
/** timer */
private long time = 0;
/** The number of aliens left on the screen */
private int alienCount;
/** The message to display which waiting for a key press */
private String message = "";
/** True if we're holding up game play until a key has been pressed */
private boolean waitingForKeyPress = true;
/** True if the left cursor key is currently pressed */
private boolean leftPressed = false;
/** True if the right cursor key is currently pressed */
private boolean rightPressed = false;
/** True if we are firing */
private boolean firePressed = false;
/** True if game logic needs to be applied this loop, normally as a result of a game event */
private boolean logicRequiredThisLoop = false;
private static Image drop;
/** The constant for the width*/
private int DOMAIN = 800;
/** The constant fot the length*/
private int RANGE = 950;
/** The constant for the number of rows of aliens */
private int numbaofrows = 8;
/** The constant for the number of aliens per row */
private int aliensperrow = 12;
/** The constant for the percent of which the speed increases*/
private double speedincrease = 1.02;
/** Starts the variable that counts the shots*/
private int shotsfired = 0;
/** Construct our game and set it running.*/
public Main() {
// Creates a frame to contain Main.
JFrame container = new JFrame("SPACE INVADERS !!! WOOT !!! WOOT !!!");
// Gets a hold of the content of the frame and sets up the resolution of the game
// Names the inside of the "container" as panel.
JPanel panel = (JPanel) container.getContentPane();
// Stes the demensions of the panel.
panel.setPreferredSize(new Dimension(DOMAIN,RANGE));
//Sets the layout as nothing which overrides any automatic properties.
panel.setLayout(null);
// Sets up our canvas size and puts it into the content of the frame
setBounds(0, 0, DOMAIN, RANGE);
panel.add(this);
// Tell AWT not to bother repainting our canvas since we're
// going to do that our self in accelerated mode.
setIgnoreRepaint(true);
// Actually sizes the window approximately.
container.pack();
// Makes it so that the window can't be resized.
container.setResizable(false);
// Makes the window visible.
container.setVisible(true);
// Add a listener to respond to the user pressing the x.
// End the program when the window is closed.
container.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
// add a key input system (defined below) to our canvas
// so we can respond to key pressed
addKeyListener(new KeyInputHandler());
// request the focus so key events come to us
requestFocus();
// Create the buffering strategy which will allow AWT
// to manage our accelerated graphics.
createBufferStrategy(2);
strategy = getBufferStrategy();
// initialise the entities in our game so there's something
// to see at startup
initEntities();
time = System.currentTimeMillis();
* Start a fresh game, this should clear out any old data and
* create a new set.
private void startGame() {
// clear out any existing entities and intialise a new set
entities.clear();
initEntities();
// blank out any keyboard settings we might currently have
leftPressed = false;
rightPressed = false;
firePressed = false;
* Initialise the starting state of the entities (ship and aliens). Each
* entitiy will be added to the overall list of entities in the game.
private void initEntities() {
ClassLoader cloader = Main.class.getClassLoader();
drop = Toolkit.getDefaultToolkit().getImage(cloader.getResource("drop.gif"));
prepareImage(drop, this);
// create the player ship and place it in the center of the screen
ship = new ShipEntity(this,"background.gif", 0, (RANGE - 75));
entities.add(ship);
ship = new ShipEntity(this,"ship.gif", (DOMAIN / 2) - 0, (RANGE - 50));
entities.add(ship);
// create a block of aliens
alienCount = 0;
for (int row = 0; row < numbaofrows; row++) {
for (int x = 0; x < aliensperrow; x++) {
alien = new AlienEntity(this,"alien.gif", 100 + (x*50),(50)+row*30);
entities.add(alien);
alienCount++;
* Notification from a game entity that the logic of the game
* should be run at the next opportunity (normally as a result of some
* game event)
public void updateLogic() {
logicRequiredThisLoop = true;
* Remove an entity from the game. The entity removed will
* no longer move or be drawn.
* Remove the entity
public void removeEntity(Entity entity) {
removeList.add(entity);
/**Notify that the player has died.*/
public void notifyDeath() {
message = "Oh no! The aliens win, wanna try again?";
waitingForKeyPress = true;
/** Notification that the player has won since all the aliensare dead.*/
public void notifyWin() {
long time2;
time2 = (System.currentTimeMillis() - time) / 1000;
int acuracy = 1000*(aliensperrow*numbaofrows)/shotsfired;
message = "Congradulations! You win! Your time was: " + time2 + " seconds. Your acuracy was " + acuracy + "%.";
waitingForKeyPress = true;
/**Notification that an alien has been killed*/
public void notifyAlienKilled() {
// reduce the alient count, if there are none left, the player has won!
alienCount--;
if (alienCount == 0) {
notifyWin();
// if there are still some aliens left then they all need to get faster, so
// speed up all the existing aliens
for (int i = 0; i < entities.size(); i++) {
Entity entity = (Entity) entities.get(i);
if (entity instanceof AlienEntity) {
// speed up every time the aliens move down
entity.setHorizontalMovement(entity.getHorizontalMovement() * speedincrease);
/**Attempt to fire a shot from the player. Its called "try" since we must first
* check that the player can fire at this point, i.e. has he/she waited long
* enough between shots.*/
public void tryToFire() {
// check that we have been waiting long enough to fire
if (System.currentTimeMillis() - lastFire < firingInterval) {
return;
// if we waited long enough, create the shot entity, and record the time.
lastFire = System.currentTimeMillis();
ShotEntity shot = new ShotEntity(this, "bullet.gif", ship.getX() + 27, ship.getY() - 30);
entities.add(shot);
* The main game loop. This loop is running during all game
* play as is responsible for the following activities:
* - Working out the speed of the game loop to update moves
* - Moving the game entities
* - Drawing the screen contents (entities, text)
* - Updating game events
* - Checking Input
public void gameLoop() {
long lastLoopTime = System.currentTimeMillis();
// Keep looping around till the game ends.
while (gameRunning) {
// Work out how long its been since the last update, this
// will be used to calculate how far the entities should
// move this loop.
long delta = System.currentTimeMillis() - lastLoopTime;
lastLoopTime = System.currentTimeMillis();
// Get hold of a graphics context for the accelerated
// surface and black it out.
Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
g.setColor(Color.black);
g.fillRect(0, 0, DOMAIN, RANGE);
// Cycle around asking for each entity to move itself.
if (!waitingForKeyPress) {
for (int i = 0; i < entities.size(); i++) {
Entity entity = (Entity) entities.get(i);
entity.move(delta);
// cycle round drawing all the entities we have in the game
for (int i = 0; i < entities.size(); i++) {
Entity entity = (Entity) entities.get(i);
entity.draw(g);
// brute force collisions, compare every entity against
// every other entity. If any of them collide notify
// both entities that the collision has occured
for (int p = 0; p < entities.size(); p++) {
for (int s = p + 1; s < entities.size(); s++) {
Entity me = (Entity) entities.get(p);
Entity him = (Entity) entities.get(s);
if (me.collidesWith(him)) {
me.collidedWith(him);
him.collidedWith(me);
// remove any entity that has been marked for clear up
entities.removeAll(removeList);
removeList.clear();
// if a game event has indicated that game logic should
// be resolved, cycle round every entity requesting that
// their personal logic should be considered.
if (logicRequiredThisLoop) {
for (int i = 0; i < entities.size(); i++) {
Entity entity = (Entity) entities.get(i);
entity.doLogic();
logicRequiredThisLoop = false;
// if we're waiting for an "any key" press then draw the
// current message
if (waitingForKeyPress) {
g.setColor(Color.green);
g.drawString(message,(DOMAIN-g.getFontMetrics().stringWidth(message)) / 2, 250);
g.drawString("TO PLAY, PRESS ANY KEY : )", (DOMAIN-g.getFontMetrics().stringWidth("TO PLAY, PRESS ANY KEY : )")) / 2, 40);
// Clear up the graphics.
g.dispose();
// Flip the buffer over.
strategy.show();
// resolve the movement of the ship. First assume the ship
// isn't moving. If either cursor key is pressed then
// update the movement appropraitely
ship.setHorizontalMovement(0);
if ((leftPressed) && (!rightPressed)) {
ship.setHorizontalMovement(-moveSpeed);
} else if ((rightPressed) && (!leftPressed)) {
ship.setHorizontalMovement(moveSpeed);
// if we're pressing fire, attempt to fire
if (firePressed) {
shotsfired++;
tryToFire();
// finally pause for a bit. Note: this should run us at about
// 100 fps but on windows this might vary each loop due to
// a bad implementation of timer
try { Thread.sleep(10); } catch (Exception e) {}
* A class to handle keyboard input from the user. The class
* handles both dynamic input during game play, i.e. left/right
* and shoot, and more static type input (i.e. press any key to
* continue)
* This has been implemented as an inner class more through
* habbit then anything else. Its perfectly normal to implement
* this as seperate class if slight less convienient.
private class KeyInputHandler extends KeyAdapter {
/** The number of key presses we've had while waiting for an "any key" press */
private int pressCount = 1;
* Notification from AWT that a key has been pressed. Note that
* a key being pressed is equal to being pushed down but NOT
* released. Thats where keyTyped() comes in.
* @param e The details of the key that was pressed
public void keyPressed(KeyEvent e) {
// if we're waiting for an "any key" typed then we don't
// want to do anything with just a "press"
if (waitingForKeyPress) {
return;
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
leftPressed = true;
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
rightPressed = true;
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
firePressed = true;
* Notification from AWT that a key has been released.
* @param e The details of the key that was released
public void keyReleased(KeyEvent e) {
// if we're waiting for an "any key" typed then we don't
// want to do anything with just a "released"
if (waitingForKeyPress) {
return;
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
leftPressed = false;
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
rightPressed = false;
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
firePressed = false;
* Notification from AWT that a key has been typed. Note that
* typing a key means to both press and then release it.
* @param e The details of the key that was typed.
public void keyTyped(KeyEvent e) {
// if we're waiting for a "any key" type then
// check if we've recieved any recently. We may
// have had a keyType() event from the user releasing
// the shoot or move keys, hence the use of the "pressCount"
// counter.
if (waitingForKeyPress) {
if (pressCount == 1) {
// since we've now recieved our key typed
// event we can mark it as such and start
// our new game
waitingForKeyPress = false;
startGame();
pressCount = 0;
} else {
pressCount++;
// if we hit escape, then quit the game
if (e.getKeyChar() == 27) {
System.exit(0);
* The entry point into the game. We'll simply create an
* instance of class which will start the display and game
* loop.
* @param argv The arguments that are passed into our game
public static void main(String argv[]) {
Main g = new Main();
// Starts the main game loop, this method will not return until the game has finished running. Hence we are
// using the actual main thread to run the game.
g.gameLoop();
}Ap_Compsci_student_13 wrote:
ok sorry but doesn't sscce say to post the whole code?the first S is Short, and yes, it needs to be all the code needed to illustrate the problem and let use reproduce it. If you were developing a new Web framework, your example might be short, but for a student game it's very long. -
How to use the Rectangle class to draw an image and center it in a JPanel
I sent an earlier post on how to center an image in a JPanel using the Rectangle class. I was asked to send an executable code which will show the malfunction. The code below is an executable code and a small part of a very big project. To simplifiy things, it is just a JFrame and a JPanel with an open dialog. Once executed the JFrame and the FileDialog will open. You can then navigate to a .gif or a .jpg picture and open it. What I want is for the picture to be centered in the middle of the JPanel and not the upper left corner. It is also important to stress that, I am usinig the Rectangle class to draw the Image. The region of interest is where the rectangle is created. In the constructor of the CenterRect class, I initialize the Rectangle class. Then I use paintComponent in the CenterRect class to draw the Image. The other classes are just support classes. The MyImage class is an extended image class which also has a draw() method. Any assistance in getting the Rectangle to show at the center of the JPanel without affecting the size and shape of the image will be greatly appreciated.
I have divided the code into three parts. They are all supposed to be on one file in order to execute.
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
public class CenterRect extends JPanel {
public static Rectangle srcRect;
Insets insets = null;
Image image;
MyImage imp;
private double magnification;
private int dstWidth, dstHeight;
public CenterRect(MyImage imp){
insets = getInsets();
this.imp = imp;
int width = imp.getWidth();
int height = imp.getHeight();
ImagePanel.init();
srcRect = new Rectangle(0,0, width, height);
srcRect.setLocation(0,0);
setDrawingSize(width, height);
magnification = 1.0;
public void setDrawingSize(int width, int height) {
dstWidth = width;
dstHeight = height;
setSize(dstWidth, dstHeight);
public void paintComponent(Graphics g) {
Image img = imp.getImage();
try {
if (img!=null)
g.drawImage(img,0,0, (int)(srcRect.width*magnification), (int)(srcRect.height*magnification),
srcRect.x, srcRect.y, srcRect.x+srcRect.width, srcRect.y+srcRect.height, null);
catch(OutOfMemoryError e) {e.printStackTrace();}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Opener().openImage();
class Opener{
private String dir;
private String name;
private static String defaultDirectory;
JFrame parent;
public Opener() {
initComponents();
public void initComponents(){
parent = new JFrame();
parent.setContentPane(ImagePanel.panel);
parent.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
parent.setExtendedState(JFrame.MAXIMIZED_BOTH);
parent.setVisible(true);
public void openDialog(String title, String path){
if (path==null || path.equals("")) {
FileDialog fd = new FileDialog(parent, title);
defaultDirectory = "dir.image";
if (defaultDirectory!=null)
fd.setDirectory(defaultDirectory);
fd.setVisible(true);
name = fd.getFile();
if (name!=null) {
dir = fd.getDirectory();
defaultDirectory = dir;
fd.dispose();
if (parent==null)
return;
} else {
int i = path.lastIndexOf('/');
if (i==-1)
i = path.lastIndexOf('\\');
if (i>0) {
dir = path.substring(0, i+1);
name = path.substring(i+1);
} else {
dir = "";
name = path;
public MyImage openImage(String directory, String name) {
MyImage imp = openJpegOrGif(dir, name);
return imp;
public void openImage() {
openDialog("Open...", "");
String directory = dir;
String name = this.name;
if (name==null)
return;
MyImage imp = openImage(directory, name);
if (imp!=null) imp.show();
MyImage openJpegOrGif(String dir, String name) {
MyImage imp = null;
Image img = Toolkit.getDefaultToolkit().getImage(dir+name);
if (img!=null) {
imp = new MyImage(name, img);
FileInfo fi = new FileInfo();
fi.fileFormat = fi.GIF_OR_JPG;
fi.fileName = name;
fi.directory = dir;
imp.setFileInfo(fi);
return imp;
}This is the second part. It is a continuation of the first part. They are all supposed to be on one file.
class MyImage implements ImageObserver{
private int imageUpdateY, imageUpdateW,width,height;
private boolean imageLoaded;
private static int currentID = -1;
private int ID;
private static Component comp;
protected ImageProcessor ip;
private String title;
protected Image img;
private static int xbase = -1;
private static int ybase,xloc,yloc;
private static int count = 0;
private static final int XINC = 8;
private static final int YINC = 12;
private int originalScale = 1;
private FileInfo fileInfo;
ImagePanel win;
/** Constructs an ImagePlus from an AWT Image. The first argument
* will be used as the title of the window that displays the image. */
public MyImage(String title, Image img) {
this.title = title;
ID = --currentID;
if (img!=null)
setImage(img);
public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) {
imageUpdateY = y;
imageUpdateW = w;
imageLoaded = (flags & (ALLBITS|FRAMEBITS|ABORT)) != 0;
return !imageLoaded;
public int getWidth() {
return width;
public int getHeight() {
return height;
/** Replaces the ImageProcessor, if any, with the one specified.
* Set 'title' to null to leave the image title unchanged. */
public void setProcessor(String title, ImageProcessor ip) {
if (title!=null) this.title = title;
this.ip = ip;
img = ip.createImage();
boolean newSize = width!=ip.getWidth() || height!=ip.getHeight();
width = ip.getWidth();
height = ip.getHeight();
if (win!=null && newSize) {
win = new ImagePanel(this);
public void draw(){
CenterRect ic = null;
win = new ImagePanel(this);
if (win!=null){
win.addIC(this);
win.getCanvas().repaint();
ic = win .getCanvas();
win.panel.add(ic);
int width = win.imp.getWidth();
int height = win.imp.getHeight();
Point ijLoc = new Point(10,32);
if (xbase==-1) {
xbase = 5;
ybase = ijLoc.y;
xloc = xbase;
yloc = ybase;
if ((xloc+width)>ijLoc.x && yloc<(ybase+20))
yloc = ybase+20;
int x = xloc;
int y = yloc;
xloc += XINC;
yloc += YINC;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
count++;
if (count%6==0) {
xloc = xbase;
yloc = ybase;
int scale = 1;
while (xbase+XINC*4+width/scale>screen.width || ybase+YINC*4+height/scale>screen.height)
if (scale>1) {
originalScale = scale;
ic.setDrawingSize(width/scale, height/scale);
/** Returns the current AWT image. */
public Image getImage() {
if (img==null && ip!=null)
img = ip.createImage();
return img;
/** Replaces the AWT image, if any, with the one specified. */
public void setImage(Image img) {
waitForImage(img);
this.img = img;
JPanel panel = ImagePanel.panel;
width = img.getWidth(panel);
height = img.getHeight(panel);
ip = null;
/** Opens a window to display this image and clears the status bar. */
public void show() {
show("");
/** Opens a window to display this image and displays
* 'statusMessage' in the status bar. */
public void show(String statusMessage) {
if (img==null && ip!=null){
img = ip.createImage();
if ((img!=null) && (width>=0) && (height>=0)) {
win = new ImagePanel(this);
draw();
private void waitForImage(Image img) {
if (comp==null) {
comp = ImagePanel.panel;
if (comp==null)
comp = new JPanel();
imageLoaded = false;
if (!comp.prepareImage(img, this)) {
double progress;
while (!imageLoaded) {
if (imageUpdateW>1) {
progress = (double)imageUpdateY/imageUpdateW;
if (!(progress<1.0)) {
progress = 1.0 - (progress-1.0);
if (progress<0.0) progress = 0.9;
public void setFileInfo(FileInfo fi) {
fi.pixels = null;
fileInfo = fi;
} -
Scrolling Text and Images in Flash CS3
I am pretty new to Flash and I have spent all day trying to
look up tutorials on making it possible to scroll text and images
in Flash but none of them are working for me. I know you save the
content into a movie clip but that's as far as i have gotten. would
anyone be able to walk me through this PLEASE???
Thanks,
PeterYou could use a Swing HTMLPANE or draw it all onto a
BufferedImage and display that (code posted under 2D graphics thread).
MArk -
Alternative image to flash file
hello
how do i add a alternative gif or jpeg image if the flash
file won't load in a browser. for example when i view my site on an
iphone the flash file doesn't display so i would like a static
image in it's place.
any help much appreciated.... PHello,
Check out these two links:
http://www.alistapart.com/articles/flashembedcagematch/
http://code.google.com/p/swfobject/
Start with the documentation link at the top.
Hope that helps.
Take care,
Tim
"pgc1" <[email protected]> wrote in message
news:g8kt15$gqu$[email protected]..
> hello
>
> how do i add a alternative gif or jpeg image if the
flash file won't load
> in a
> browser. for example when i view my site on an iphone
the flash file
> doesn't
> display so i would like a static image in it's place.
>
> any help much appreciated.... P
> -
if you have the checkbox for use imported jpeg data selected
within the info for an image, does this mean that there will be
ZERO compression applied to the image from Flash when it is
exported?
Thanks.This from the Flash help file:
The JPEG format lets you save an image as a highly
compressed, 24-bit
bitmap. Generally, GIF format is better for exporting line
art, and JPEG
format is better for images with continuous tones, such as
photographs,
gradients, or embedded bitmaps.
Flash exports the first frame in the SWF file as a JPEG,
unless you mark a
different keyframe for export by entering the #Static frame
label.
1.. Select File > Publish Settings, click Formats, and
select JPEG Image.
2.. For the JPEG filename, either use the default filename,
or enter a new
filename with the .jpg extension.
3.. Click JPEG. Dimensions Enter values for width and height
in pixels for
the exported bitmap image, or select Match Movie to make the
JPEG image the
same size as the Stage and maintain the aspect ratio of your
original image.
Quality Drag the slider or enter a value to control the
amount of
JPEG file compression. The lower the image quality, the
smaller the file
size, and the reverse. To determine the best compromise
between size and
quality, try different settings.
Note: To change the object's compression setting, use the
Bitmap
Properties dialog box to set the bitmap export quality per
object. The
default compression option in the Bitmap Properties dialog
box applies the
Publish Settings JPEG Quality option.
Progressive Show Progressive JPEG images incrementally in a
web
browser, which makes images appear faster when loading with a
slow network
connection. Similar to interlacing in GIF and PNG images.
4.. Click OK.
http://livedocs.adobe.com/flash/9.0/UsingFlash/WSd60f23110762d6b883b18f10cb1fe1af6-7bc7.ht ml
Dan Smith > adobe community expert
http://www.dsmith.tv
"StanWelks" <[email protected]> wrote in
message
news:[email protected]...
> if you have the checkbox for use imported jpeg data
selected within the
> info
> for an image, does this mean that there will be ZERO
compression applied
> to the
> image from Flash when it is exported?
>
> Thanks.
> -
Manipulate illustrator images in Flash
Once i have imported Illustrator images into Flash (CS3) can
i manipulate them, to animate them? If so How?
Thanks
Tsledrevy,
> Once i have imported Illustrator images into Flash (CS3)
> can i manipulate them, to animate them? If so How?
You'll find that your imported images are probably layered
or nested
into numerous groups, drawing objects, and symbols. Any one
of those
elements (groups, options, or symbols) behave just as if they
were created
in Flash, and you can minuplate them as such.
If an imported image (with all its nested elements) is
already on the
Stage, just select the whole collection and convert the whole
thing into a
symbol. At that point, your symbol will behave just like any
other ... you
can move it as a collective group, you can change its alpha
transparency,
give it a tint, and so on. If your symbol is a movie clip,
you can also
alter its blend mode and add effects, such as drop shadow,
blur, and the
like.
Let me know if that helps, or if you still have questions.
David Stiller
Co-author, Foundation Flash CS4 for Designers
http://tinyurl.com/5j55cv
"Luck is the residue of good design." -
Capturing live stream to static image on server
As part of a kludge we're working on to get around showing inline video (from cams) on devices such as iPhone which isn't supported by flash, we're planning to use websockets to stream data instead. We've seen a few other similar services do something similar as a kludge. There is no audio but at least something is visible to the user on devices that don't support flash or where inline HLS is not available (iPhone!).
Capturing static data on the FMS seems like quite a common request (e.g. to make thumbnails or whatever) but is there code available to do this? I have looked but found nothing as of yet. As part of the solution, streams will need to be saved to static images e.g. every x seconds, on the FMS server.
Any help or pointers welcome
Puzzler.As part of a kludge we're working on to get around showing inline video (from cams) on devices such as iPhone which isn't supported by flash, we're planning to use websockets to stream data instead. We've seen a few other similar services do something similar as a kludge. There is no audio but at least something is visible to the user on devices that don't support flash or where inline HLS is not available (iPhone!).
Capturing static data on the FMS seems like quite a common request (e.g. to make thumbnails or whatever) but is there code available to do this? I have looked but found nothing as of yet. As part of the solution, streams will need to be saved to static images e.g. every x seconds, on the FMS server.
Any help or pointers welcome
Puzzler. -
Using swf file for very large static image
i have a large photo that i need to use as a banner image in a website. i have tried optimizing it for the web in fireworks -- to reduce the file size obviously -- but the client isn't happy with the resolution. i haven't had this issue come up before but i see his point (to a degree), as the detail and sharpness of the original is far superior.
i have almost no familiarity with creating with flash, but i remember reading somewhere that swf files do not have the same sizes as jpeg images.
would it be feasible to include the single static image as a swf file to preserve its original resolution? i mean, would that image as a swf file be smaller than the image as a jpeg?
mille grazie.There are two things at play here... image quality (often harmed by compression) and image resolution (# of pixels width by height). What is the real problem?
Whether you render your image as a GIF, JPG, PNG or SWF file, they will all have the same resolution.
Packing an image in SWF should be a last resort as not everyone has Flash installed. For example, iPhone users cannot see SWF. -
Hi ,
I want to convert my dynamic Drawing (that I created in a Flash Dialog using AS 3) into the .DXF and .DWG format.Is there any way by which I can give the export functionality on the flash page so that the dynamic drawing that created in flash code will export into .DXF and .DWG format.
Please Help
Thanks,
SimonThere's no automatic way to convert to AutoCAD formats... you will need to write your own. You will need to figure out the formats of .dxf and .dwg and then probably use ByteArray to output. It will not be a trivial task.
Hi,
Can you please give me some example for this?
I have used AlivePDF to convert my Diagram to PDF but it create a Raster image in PDF and all vector data is lost.
I want to convert this PDF to .dxf and .dwg format using any tool. but not found any way around.
Thanks!! -
How to draw an Image on a JPanel?
Hi all,
Can any one give code for drawing an image on a JPanel?
thanks,
amarThat's for the JLabel right? ... For a JPanel on a JFrame, you could do something like this:
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import java.net.URL;
public class TestImagePaint extends JFrame {
private BjPanel bjp;
public TestImagePaint( String imageName ) throws IllegalArgumentException {
if ( imageName == null || !( new File( imageName ).isFile() ) ) {
throw new IllegalArgumentException( "\nIn TestImagePaint constuctor"
+"\t IllegalArgumentException:" );
bjp = new BjPanel( imageName );
getContentPane().add( bjp );
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setBounds( 100, 100, 400, 300 );
setVisible( true );
public static void main( String[] argv ) {
new TestImagePaint( argv[0] );
public class BjPanel extends JPanel {
private URL url;
private Image image;
public BjPanel( String imageName ) {
try {
url = BjPanel.class.getResource( imageName );
image = Toolkit.getDefaultToolkit().getImage( url );
repaint();
catch( Exception e ) {
System.out.println( "Can't get Image: "+imageName+"\n\t"+e );
System.exit( -1 );
public void paint(Graphics g) {
g.drawImage( image, 0, 0, this );
}
Maybe you are looking for
-
Foreign Currency Valuation - BRS
Hi Gurus, Please go through the following business process 1. Sales invoice 100 USD @ 45 2. Incoming amount 100 USD @ 50 3. BRS - Transfer amount from incoming account to main account in the 3rd point, the exchange rate maintained in ob08 is 51 and w
-
Problem with concatenating space character. Please help!
Hi experts, I have requirement for creating fixed length data like this: Source Material. I am getting source value dynamically. Max size of source in 10. But sometime it may come as 'EMS01' and sometimes 'PLTN'. That its value can be of varied
-
Hi experts, Yesterday I have simulated a scenario in which PR is created with Account assigned category K. In this PR Requisitioner is MIKET, his dollar limit is 1000 USD and PR amount is 1,00,000 USD. AS PR amount is more than Requisitioner limit 1s
-
C compiler for macbook pro 2011 OS X LION
can anyone tell me , I am new to mac , I used to use the Dev C++ compiler for windows to do my uniersity programing practise , can anyone please tell me any alternative for Mac OS X LION .
-
I try to open an URL but the site does not open. How comes?
I try to open a site. But it does not. MAverix? Some block? Who can help me?