Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Trouble Zooming The Image Correctly



Hello,

I have a flash file that lets you zoom pictures. My problem is when I zoom the picture the picture moves to the bottom-right. Meaning that the x and y values increases.

Now, what I want is for the picture to zoom from the center of the picture. And not from right to left, as it does right now. You see what I mean if you test the file. Again, I want the picture to zoom from the center straight at me.

Hope you understood my explanation.

Very gratefull if anyone can help me solve this problem.



FlashKit > Flash Help > Flash MX
Posted on: 07-01-2004, 08:50 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Zooming In On An Image With Action Script Without Zooming The Entire Frame In
How do I zoom in on "1" image so its like 2x or 3x the normal size, but its only in that frame, like the entire stage wont zoom in, just that image will, and it will stay in a 546 * 281 format ?

Is this understandable?

Another example would be

(My image size is 546 * 281)

You click a button, it zooms in on the image, however everything else on the main frame does not move, just the image zooms in (still staying the same size)

Trouble Playing MC Correctly...
I'm having some issues with a MC. If you click here, you will notice that all appears to be working correctly. However, if you click here and click on the bikini section, suddenly everything stops working. Can anyone tell me why this occurs and how to fix it, please?

Thanks!!

Bobby.

Zooming An Image
Good afternoon,

I would like to know if I can,using an image make a zoom for it,whit bottons for zoom in and zoom out...If possible, what must I dont? Can I do this,without any transformations, or movie clips and tweens...

Tks,
Angelistis.

Zooming On Image
Hey

I currently working on a site. and i wan't to put a map on it. By map i mean a road description. I was wondering if it was possible to start from a totally zoomed out image and then let the person zoom in. And i don't want it by clicking the right mouse button and then zoom. I wan't to put a magnifying (don't know how to spell it) glass on the stage, and when they click it, it zooms automaticly. i know you can do it by loading a different image echt time the users clicks, but i just want to use the one image. is this possible??

thx

Diederik

Zooming In And Out On An Image
Is there a way to that users can zoom in and out of an image and even drag/scroll around if the image is larger than the viewing window. I looking for a way to creativly display my portfolio in a limited area. Any direction would me much appreciated.

[CS3] Zooming An Image/MC In AS2
Hi everyone,

Here am I with this silly-sounding problem.
I have a movie clip which should be zoomed in and out.
Somehow Iam stuck on twoo simple phases which are:

1. I want the movie clip to stop zooming when a particular size is reached...so to say, to hide the zoomIn button and vice versa for the zoomOut.

2. The movie clip should also be draggable, s that one can pan and view all the detail. I worte the drag script but it always dragged the movie clip to the endge of the stage so my G shows. I want the MC to stop being dragged when for example the right edge reaches the edge ofthe stage or the overlying mask..and so on and so forth for all the co-ordinates.


Here is my code

mgl.lzIn._visible = true
mgl.lzOut._visible = true
lzEndIn._visible = false
lzEndOut._visible = false


var zIn:Number = 5;
var xfull:Number = stage.width;
var yfull:Number = stage.height;
var xstop:Number = stage.width*2;

car._xscale -= 40;
car._yscale -= 40;


//Here I want to zoom it in and it functions

mgl.lzIn.onPress = function()
{
if (car._xscale>=-40 && car._yscale>=-40 )
{
car._xscale += zIn;
car._yscale += zIn;


}else{
car._xscale>=-40 && car._yscale>=-40
}
}


HERE I want to add conditionals to the zoom button 'lzIn' to be deactivated when 'car'
reaches about twice the size of the stage,so that one cannot zoom anymore
In this case, the zoomIn button (lzIn) becomes invisible
and the endzoom button(lzEndIn) which has no actions attached to it becomes visible
what statement do i use?


//ZoomOut Conditions
mgl.lzOut.onPress = function()
{
if (car._xscale>-40 && car._yscale>-40 )
{
car._xscale -= zIn;
car._yscale -= zIn;
}else{
car._xscale>=-40 && car._yscale>=-40
}
}


HERE I wanted too put conditional statements so the zoom button 'lzOut' to be deactivated when 'car'
reaches BACK the original size it was on load which is -40
In this case, the zoomOut button (lzOut) becomes invisible
and the endZoomOut button(lzEndOut) which has no actions attached to it becomes visible



NEXT
I want the car to be draggable on the x and y radius when it gets bigger than stage-size,
so one can see all the zoomed parts. I have tried it but it always dragged
the car even away from the edge of the screen, so that my BG was showing

Can anyone possibly help me out and be my hero?

Thanks in advance
I had wanted to post the file but do not know how that goes here..any suggestions?

Zooming In And Out On An Image
Is there a way to that users can zoom in and out of an image and even drag/scroll around if the image is larger than the viewing window. I looking for a way to creativly display my portfolio in a limited area. Any direction would me much appreciated.

Zooming In And Out On An Image
Is there a way to that users can zoom in and out of an image and even drag/scroll around if the image is larger than the viewing window. I looking for a way to creativly display my portfolio in a limited area. Any direction would me much appreciated.

Zooming In On An Image
Thanks in advance to anyone who can help with this.
I have a large jpeg that I want to move across (using a mask) and then zoom in on. Does anyone the best way to do this whilst keeping the kb's down?



Zooming An Image In And Out
I need a loop (I'm assuming). Here is the current code that I have on a button.

on(rollOver){
_root.pic._xscale=18.15;
_root.pic._yscale=18.15;
}


now what we want to do is give the appearce of panning and zooming the picture as if it is a camera.

There is no problem with the panning, I can do that, but the "zooming" is the problem. Basically what I need to do is increment the _xscale and _yscale of the image while someone is rolled over this button.

I need it to increment by .05 every 1/24th of a second. (Frame rate is 24 fps on this swf.)

Any help would be MUCH appreciated.

Thanks.

CFB Button And Zooming On An Image.
I used this tutorial:

http://www.webclass.ru/eng/Tutorials...k_buttons.html

to find out how to make CFB's that would zoom a picture. I have two questions, and I know it is probably simple code but still:

1. I want to set limits on how big and small the picture that is being zoomed can be. How do I set limits like that?

2. I don't want the picture to zoom from the middle, and by that expanding from the middle (like the example on the page), but instead I want it to stay anchored and then zoom while anchored to a spot. (For example I want the pic to stay anchored to the bottom and expand while staying anchored to the bottom instead of anchored in the middle like the example) How would I establish this?

Thank you very much for helping out a newbie to this forum...and somewhat still new to flash.

Hi-Res Image Zooming Software
Has anybody had experience with Zoomify or FXWitz Hi-Rez. I am debating on purchasing one or the other or something that can do the same thing. Does anyone have a preference or can you give me some feedback? thanks

Flash Image Zooming
Hi All,

Im trying to create a movie like in the header of:
http://www.mrandmrssmith.com/boutiqu..._design_hotel/

However, when i scale the image in the animation, it dithers in the final swf.

Also can anyone help for the actionscipt with this sort of zooming image gallery.

Many many thanks to anyone who helps.

Regards,
Ian

Zooming In On A Panned Image
I'm panning on an image 2kx2k pixels. Panning is working wonderfully. I added a scrollRect to the image container and test the mouse position blah blah blah....I'm trying to add zoom and now things have gotten a little hairy

Main Movie -> PanClass Object -> Image Container -> External Swf.

I have a couple test buttons that simply allow a user to zoom in or out on that image. I figured that by zooming in (adjusting x and y scale) of the external swf that my movie would scale and continue to pan which it does, but it is still panning at the original size of the image. I need it to pan in the same size window as before but with the new scaled dimensions. I've included the panImage function. What do I need to adjust so that it will behave as I want?

Mike









Attach Code

public function panImage( e:Event ):void
{
mouse.x = target.mouseX;
mouse.y = target.mouseY;

if ( r_mask.containsPoint( mouse ) )
{
panX = ( (Math.abs( image.x - mouse.x) / rect.width ) * ( r_img.width - rect.width ) );
panY = ( (Math.abs( image.y - mouse.y) / rect.height ) * ( r_img.height - rect.height ) );
}

rect.x += (panX - rect.x) / speed;
rect.y += (panY - rect.y) / speed;

image.scrollRect = rect;
}

Zooming In On Image And Greying Everything Else Out?
How do you create the effect created when someone clicks on a button it
magnifies an image and everything else becomes greyed out?

Thanks.

Zooming And Panning An Image
I have loaded an image from a particular site using loader.. and added this loader in a Movieclip.. I want to zoom and pan the image.. How to zoom particular area of a movieclip?

Zooming In On Certain Area's Of An Image
Hi Everyone

I have searched around the forum and searched the tutorials but cant quite find what im looking for.

I have been learning flash (mainly actionscript 3) and im becoming pretty good with it and can do most things I need to but I have been having problems trying to solve this 1 thing so here goes...

Say I have a JPEG image 400x300 and I wanted it to zoom in when I click on a certain area of the image, lets say I clicked on a persons head on the image it would zoom in "on the head"

Im actually half way there I have set an eventlister so when someone clicks on the image it changes the scaleX & Y properies but this obviosuly doesnt zoom the part of the mouse exactly so I tried to change the normal x & y properies to the same as the mouse but this didnt bring the results needed.

I hope that made sense and if anybody could point me to a tutorial or info on the subject i would be very gratefull.

Thanks

When Zooming, Image Shifts.
Everytime i zoom my image keeps shifting, can anybody help? i d like to, when zooming, to zoom toward the center of whats visible.

Anybody know what to do?
Here is the code:

Image Scrolling/Zooming/Coolness
Anyone know how this was done or where I can find a source file?
If you enter this site, go to any of the interior pages and you'll notice the mouse interacting with the bkg image to zoom and pan. Really nice.
I've looked and looked but can't find out how they did it.
http://www.vodafone.com/flash/future...l&bandwidth=hi

Thanks! - Gary

[F8] Zooming In On A Map > Keeping Image Centered?
Hi guys, gals, and others,

This is driving me insane!

I'm building a little flash app - a scrolling, zoomable map. I've got the file to load in variables from an XML file, I've got the scrolling working, and I've got a failsafe function to stop the image going off the edge of the screen - but the zooming part has got me stumped.

I'm not really much good at math, and I think this is where my problem comes in. I can get the image to zoom in and out to a certain level without leaving the confines of the viewport/stage, but the containing mc's registration point is in the top-left, and this is where the movie's scaling from.

I know what I need to do, I just can't seem to write the code to do it - I need the x and y position of the clip to move in sync with the scaling. For example, say there's a box in the middle of the screen at the smallest zoom level - when the user zooms in, I'd like the box to stay centred on the screen.

Any ideas? I'm at my wits' end!

Image Not Loading/displaying Correctly
hi-
i have a function (below) that is called withing a class, after an image loads. Essentially, this function creates thumbnails for each larger image. So, the strange thing is that on a trace(from the actual ParentImage class) i can watch the bytesLoaded rise, as Flash is getting the thumbnail. But, after Flash downloads the image, things go wrong and it does not appear. Below you can see i run a second trace and my results are 0,0,0,1 respectively...what am i missing. There is no issue with the URL, the images are certainly in the directory, and as i stated, i can see it is loading....if you need to see ParentImage class, i can post that next.


Code:
private function addThumbs(cd:BigPicture):void
{
thumbPath="images/Thumbnails/"+eachImage[this.counter];
var th:ParentImage=new ParentImage(this.thumbPath);
th.child=cd;
this.addChild(th);
trace(th.x,th.y,th.width,th.alpha);

}

[F5] Zooming & Image Dimension Limits
I have an image of the world in an 800 x 800 stage. The image is 800 x 800.


Code:
map._xscale = 1000;
map._yscale = 1000;
When the user clicks on the image it zooms by 1000% making the image 8000 x 8000. Unfortunately it is not zooming to this level.

Do I need to disect the image in to smaller pieces or is there a workaround?

Ta!

Zooming Into A Bitmap Image, Tracing. Help Please.
Hi,
I want to zoom into a movieclip with a bitmap image (500x375), but when zooming by increasing x and y scales (from 100% to 125%), the result is not very good.
When tracing the bitmap with an acceptable result, then the file size increases dramatically.

Any experience/suggestions ?

Stuck On Panning/Zooming An Image
It's been a long while since i've been around here, so I'm currently trying to get to grips with AS3, and what i'm trying to do is driving me nuts!

What I want to end up with is an image viewer where i can zoom in and out of the image and pan around it.

I've got so far, and have now got fairly stuck and i've googled for ages trying to find answers but don't seem to be able to find anything.

Problems:
- Zooming in on the centre of the viewing area
- Limiting the panning so you cant pull the images out of the viewing area

THE LINKS:
View Swf
Source Files

THE CODE:

Code:
package {

import flash.display.*;
import flash.events.*;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.net.URLRequest;
import flash.filters.BitmapFilterQuality;
import flash.filters.GlowFilter;
import flash.geom.Rectangle;

public class ImageViewer {

private var imgLoader:Loader;
private var container:Sprite = new Sprite();
private var frame:Sprite = new Sprite();
private var picMask:Sprite = new Sprite();
private var picTemp:Sprite = new Sprite();
private var picHolder:Sprite = new Sprite();
private var pic:Bitmap;
private var dragRect:Rectangle;

private var loadStatus_txt:TextField;
private var picWidth:int;
private var picHeight:int;
private var frameWidth:Number;
private var frameColor:Number;
private var initPicScale:*;
private var curPicScale:*;

private var btnZoomIn:myButton;
private var btnZoomOut:myButton;
/*var btnPanUp:myButton = new myButton(20,20,4,0xFFFFFF,0.7);
var btnPanDown:myButton = new myButton(20,20,4,0xFFFFFF,0.7);
var btnPanLeft:myButton = new myButton(20,20,4,0xFFFFFF,0.7);
var btnPanRight:myButton = new myButton(20,20,4,0xFFFFFF,0.7);*/

// The constructor function
public function ImageViewer ( sprite, w:int, h:int, frameWidth:Number, frameColor:Number) {
this.container = sprite;
this.picWidth = w;
this.picHeight = h;
this.frameWidth = frameWidth;
this.frameColor = frameColor;

buildViewer(w,h);
}

// The loadImage( ) method
public function loadImage (picURL:String) {
var picLdr:Loader = new Loader();
var picURLReq:URLRequest = new URLRequest(picURL);
picLdr.load(picURLReq);
picLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
function imgLoaded(event:Event):void {
trace('image loaded');

var pic:Bitmap = new Bitmap(event.target.content.bitmapData);

resizePic(pic);
}
}

private function buildViewer( w:int, h:int) {

createFrame(w,h);
createMask(w,h);
container.addChild(picHolder);

}

private function createFrame(w:int, h:int) {
frame.graphics.beginFill(frameColor);
frame.graphics.drawRect(0, 0, w, h );
var glow:GlowFilter = new GlowFilter();
glow.color = 0x666666;
glow.alpha = 0.8;
glow.blurX = 10;
glow.blurY = 10;
glow.quality = BitmapFilterQuality.MEDIUM;
frame.filters = [glow];
container.addChild(frame)
}

private function createMask(w,h) {
var maskW:int = (w-(2*frameWidth));
var maskH:int = (h-(2*frameWidth));
picMask.graphics.beginFill(0xff0000);
picMask.graphics.drawRect(frameWidth, frameWidth, maskW, maskH );
//var dragRect:Rectangle = new Rectangle(frameWidth,frameWidth,picWidth,picHeight);

}

private function resizePic(picture) {

picture.width=picWidth;
picture.scaleY=picture.scaleX;
initPicScale=1;
trace('initScale='+initPicScale)
curPicScale=initPicScale;
trace('curScale='+curPicScale);
picture.x=frameWidth;
picture.y=frameWidth;
picHolder.addChild(picture);
picHolder.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
picHolder.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
addDisplayItems()
}

private function addDisplayItems(){

container.addChild(picMask);
picHolder.mask=picMask;
}

private function createDragRect() {
var dragRect:Rectangle = new Rectangle(0,0,100,100);
}

// This function is called when the mouse button is pressed.
private function startDragging(event:MouseEvent):void {
createDragRect();
picHolder.startDrag(false, dragRect );
}

// This function is called when the mouse button is released.
private function stopDragging(event:MouseEvent):void {
picHolder.stopDrag();
}

public function createControls(size:int,padding:int,margin:int,zoom:Boolean,pan:Boolean){

var buttonSize:int = size;
var buttonMargin:int = padding;
var zoomX:Number = margin;
var zoomInY:Number = picHeight-margin-(buttonSize*2)-padding;
var zoomOutY:Number = picHeight-margin-buttonSize;
if(zoom){
addZoomControls(zoomX,zoomInY,zoomOutY,buttonSize);
}
}

private function addZoomControls(zoomX:int,zoomInY:int,zoomOutY:int,buttonSize:int) {
var btnZoomIn:myButton = new myButton(zoomX,zoomInY,buttonSize,buttonSize,4,0xffffff,0.7,true);
var btnZoomOut:myButton = new myButton(zoomX,zoomOutY,buttonSize,buttonSize,4,0xffffff,0.7,true);
container.addChild(btnZoomIn);
container.addChild(btnZoomOut);
btnZoomIn.addEventListener(MouseEvent.CLICK, zoomIn);
btnZoomOut.addEventListener(MouseEvent.CLICK, zoomOut);
}


private function zoomIn(event:MouseEvent){

trace('*************************************')
curPicScale = curPicScale+0.1
trace ('newScaler='+curPicScale);

trace('initX='+picHolder.x)

var centreX:Number = (frame.width/2)
trace('framecentreX='+frame.width/2)
trace('centreX='+centreX);
var centreY:Number = (frame.height/2)

var prevPointX:Number = (picMask.x-picHolder.x)+centreX
trace('prevPointX='+prevPointX);
var prevPointY:Number = (picMask.y-picHolder.y)+centreY

var newPointX:Number = prevPointX*curPicScale;
trace('newPointX='+newPointX)
var newPointY:Number = prevPointY*curPicScale;

var newWidth:Number = picHolder.width*curPicScale
trace('newWidth='+newWidth);
var newHeight:Number = picHolder.height*curPicScale

var difX:Number = newPointX-prevPointX;
trace('difX='+difX)
var difY:Number = newPointY-prevPointY;

var newX:Number = picHolder.x-difX;
trace('newX='+newX)
var newY:Number = picHolder.y-difY;
trace('newY='+newY)

picHolder.scaleX=curPicScale;
picHolder.scaleY=curPicScale;



picHolder.x=newX;
picHolder.y=newY;
trace('*************************************')
}

private function zoomOut(event:MouseEvent){

if(curPicScale>initPicScale){

curPicScale = (curPicScale-0.1)
trace ('newScale='+curPicScale);
if(curPicScale<1){
curPicScale=1
}

pic.scaleX=curPicScale;
pic.scaleY=curPicScale;
}
}

}

}
Please help if you can, I seem to have hit a brick wall with this - the maths on the zoom repositioning looks right to me, but it still veers off to the left!! and the bounds for the panning just don't seem to do anything! Argh!

Thanks in advance

Chris

Zooming Panned Image Question
Hello,

Its been driving me crazy and I can't seem to figure it out.

I have a pannable image that is masked by a smaller square. Everything works fine except for zooming. When the image is scaled, the viewed area shifts.

Does anyone know the calculation to keep the larger image centered inside the mask as it scales? Or is there any other solution?

Thanks for any help on this.

-e

Zooming A Selected Area Of An Image
I don't know whether this has been discussed before or not, What I want to do is I am loading one jpeg file into a movie clip and applied a predefined rectangle mask on it. I have a numeric stepper for zooming. Everything is working fine. Recently my user community want to add a new functionality to this - user clicks on the image displayed and drag the mouse to another location on the image, basically selecting a portion of the image loaded, then my action script zoomin that rectangular area(selected portion) such that the zoomed image is filled the mask so that user can see only the selected portion of the image.

I have been playing with MovieClips and I can't seem to figure them out.Any info that you could simplify for a newbie would be greatly appreciated.

Simple Flash Involving Zooming An Image
I've not yet used flash but am wanting to use it to make an enhanced visual guide for some images on my site.

I have standard sized images that are all 725x460. I'd like to have an enhanced guide that will launch flash and allow me to make that 725x460 image zoomable. To see an example of my interface go and click on any link here:

http://www.jeditemplearchives.com/otc/

Each image is 725x460. These are all resized images. My original images are much higher resolution. I would like to make an enhanced version that allows the viewer to open a similar flash interface that starts out at 725x460, but allows them to zoom in on the image to increase detail.

Thanks for any help! I'm a total newbie and have yet to make anything in flash, so any help is appreciated!

Image Crossing Screen, But Not Working Correctly
Right now I have some AS that moves my clouds across the screen like it should. I duplicated the image so that the movement would seem constant. My problem is that the second image starts to die down and move slower and slower as it comes across to the point where it just stops. Then after a few seconds, the AS kicks the first image in and then things are good. Why would the second image do that based on my AS 2.0? Thanks


import gs.TweenLite;
import gs.easing.*;

var clouds = 0;
var clouds2 = 2000;

this.logo_mc._alpha = 0;

function moveClouds():Void {
TweenLite.to(this.clouds_mc, 100, {_x: clouds - 2000, ease: Normal.easeOut, onComplete: moveClouds, onCompleteScope: this});
TweenLite.to(this.clouds2_mc, 100, {_x: clouds2 - 2000, ease: Normal.easeOut});

clouds = (clouds < -2000) ? (clouds = 2000) : (clouds - 2000);
clouds2 = (clouds2 < -2000) ? (clouds2 = 2000) : (clouds2 - 2000);
}

moveClouds();

TweenLite.to(this.logo_mc, 5, {_alpha: 100, ease: Normal.easeIn});

Zooming Specific Area Of Panned Image - Help
Hello,

I've been working on a virtual tour idea which uses a large image that is masked by a smaller square. Buttons or the mouse basically control the x and y coord.s of the large image allowing you to scroll and view it inside the smaller square.

My problem is, I want to be able to scale the larger image(sets of 10% up to maybe 250%) to zoom in, but as the image scales, the viewed area inside the mask shifts.

Does anyone know how to readjust the images x,y coords while zooming so that the area inside the mask remains in view? I'm thinking its a calculation based on the new height and width of the image as is scales, but I cant figure it out.

Any help on this would be greatly appreciated.

Thanks,

-E

Sliced Image Not Displaying Correctly When Converted To Clips
All I wanted to do was slice up an imported bitmap image into clips to then manipulate with AS. So…
I import a jpeg – select it & break it apart, then generate a grid using the line tool, position it over the bitmap – select “break apart” & start converting the squares that the jpeg has been sliced into, into individual clips – simple!!

Problem is at some stage when I convert the squares into clips & test it, it makes the whole mosaic image (Original sliced image now made up of clips) gets screwed up – squares not showing, moving out of position etc. I say “at some stage” as I can quite happily process 4 or 5 clips, test & the image remains as it should, but do one more & test it & it has gone out of whack!



I have tried “Grouping” the individual squares before converting to clips, but this has no effect.

Thanks for any help.

Fla below

Flash Not Playing Correctly - Image Size Problem
I am completely new to Flash. I am looking into a problem involving Flash on one of our websites. http://www.statlerhotel.cornell.edu/ Click "skip intro" or "always skip intro". The following page shows a flash movie ( I call it a movie ) with several images fading in an out. On most computers in our building, this works fine with no problems.

If a user has the flash player - plugin or a flash cookie is set, we show the movie. If not, a static image shows.

Problem: We've found a couple users who complain about "some" of the images in the movie appearing very small (smaller than they should be) or only have of an image appearing or loading. Then other images fade in and out fine. One user sees a problem when on this page, je goes to another web page in the same site and Back, the first image will appear too small, then it's fine.

The machines all use IE 6. We are using Adobe Flash Player 9. We have Flash Player 9 ActiveX and Adobe Flash Player Plugin installed. All pcs are on high-speed internet.

Anyone have any thoughts on what might be causing this random behavior? I honestly have no clue. Is it Flash, Plugins, Internet, the pc's, etc...???

Thanks for any tips. They will be appreciated.

Image Slight Zooming Effect, Resizing A Bitmp In A Tween..pixelated, Unsmooth..help
I'm trying to achieve this slight zooming effect with photos. Where over about 100-150 frames, an image ~550x270 is slightly transformed maybe about 5 or 10% bigger.

The problem is when it is played back it looks unsmooth and pixelated.

I imported the photos as about 50% quality jpegs from Photoshop.

Is this something that can be fixed? Please help, I'd really appreciate it.

Trouble Loading An Image
OK, I'm trying to load a jpg from my hard drive into a blank movie clip.

The clip's name is "picDisplay" and the photo file, as it resides in the same folder as my .fla file, is "photo.jpg".

Here is the AS attached to my button:

code:
on(release){
picDisplay.loadMovie("photo.jpg");
}


I'm using MX 2004

edit: Forgot to ask a question . Nothing is loading up when I press the button. What could I be doing wrong?

Trouble With Image Loader
I'm using a loader component in a screen/slide show presentation to show external jpegs images. This doesn't involve any code(and I don't need it to). I simply configure the loader component in the component inspector to load my jpeg file and it shows it. This works when I go to Test Movie, you can see all the loaded Jpegs. I also need to be able to circle letters and mark up different parts of the slide images from edit mode.

The problem is that I can't see the images in edit mode. The loader is not displaying images in the live preview edit mode. It used to work fine and I created my slide shows using this template I made with ease. But I stoped working on this project for a while, and now that I'm back to it the loader is acting screwy. If I can't see the images then a big portion of this project will not work because i need to be able to see the images in the loader while I edit.

Is there anything I may have done to disable the preview of the loader? Live preview is enabled. It doesn't seem to make a difference if it's in full preview mode or fast mode or not. Doesn't show up in any case. Please help, I'm going crazy here and can't continue my project.

Image Importing Trouble
Hello all I am such a noob.. I have been trying to import an image into my file so I can work with it.. only problem is when I do it (whether its to stage or library) all I get on the stage is a square without the image. if I test my movie I can see the image but it is really hard to work this way. can someone please tell me what I am doing wrong? Feel free to write back starting off with:

Dear Noob.. LOL I appreciate any help

Image Trouble In IE, But Not FF Or Safari.
I made a simple slideshow type viewer for a client. It works wonderfully for me in OS X using Safari and Firefox, and it works in Firefox under windows as well.

Linky

Now, the guy writing the backend stuff for the site uses windows, and noticed that when you navigate *away* from the page, and then go back, the images don't load. In IE 7. He sent me a screenshot using some http debugger.

Screenshot

So, we figured we'd use a "cache buster" in IE. I made the flash append "?<RANDOM_STRING>" when requesting the images, but it doesn't seem to do the job. The HTTP debugger shows the request occurs, but Flash never actually receives the image.

Here's the entirety of the class "SlideshowImage" which is responsible for loading the images ( and other junk, like photo credits, etc ). Hopefully somebody with more AS3 experience can hit me with the proverbial clue stick. I've been writing AS2 for a long time, but AS3 for only the last 6 months or so. I've never seen these problems in AS2, so I assume I'm doing something wrong in AS3.

A final note. I know that the XML file which describes the slideshow is being correctly loaded, since I can see the correct copy overlay and other factors. It just appears that the images never come down the pipe.







Attach Code

package fords.ui {

import caurina.transitions.*;
import zakariya.util.*;

import flash.display.*;
import flash.events.*;
import flash.net.*;

public class SlideshowImage extends Sprite {

private var _image:Bitmap;
private var _imageURL:String;
private var _targetWidth:Number;
private var _targetHeight:Number;
private var _spinner:LoadingSpinner;
private var _photoCredit:PhotoCredits;

public function SlideshowImage( path:String, targetWidth:Number, targetHeight:Number, photoCredits:String = null, cacheBust:Boolean = false ){
super();

_imageURL = path;
_targetWidth = targetWidth;
_targetHeight = targetHeight;

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener( Event.INIT, imageReady );
loader.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, imageLoadFailed );
loader.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, imageProgress );
loader.load( new URLRequest( cacheBust ? CacheBust.url( _imageURL ) : _imageURL ));

_spinner = new LoadingSpinner();
addChild( _spinner );
_spinner.x = targetWidth / 2;
_spinner.y = targetHeight / 2;

_spinner.setLabel( "Starting..." );

if ( photoCredits )
{
_photoCredit = new PhotoCredits();
_photoCredit.text = photoCredits;

_photoCredit.x = targetWidth - _photoCredit.width - 20;
_photoCredit.y = targetHeight - _photoCredit.height - 16;
}
}

override public function get width():Number { return _targetWidth; }
override public function get height():Number { return _targetHeight; }

private function imageProgress( e:ProgressEvent ):void
{
var amt:Number = e.bytesLoaded / e.bytesTotal;
var label:String = Math.ceil( amt * 100 ).toString();

_spinner.setLabel( label );
}

private function imageReady( e:Event ):void
{
var loader:Loader = Loader( e.target.loader );
_image = Bitmap( loader.content );
_image.alpha = 0;
addChild( _image );

if ( _photoCredit )
{
addChild( _photoCredit );
_photoCredit.alpha = 0;
Tweener.addTween( _photoCredit,
{
alpha: 1,
time: 1,
delay: 1
});
}

//
// Size image to fit
//

_image.smoothing = true;
_image.pixelSnapping = PixelSnapping.AUTO;
_image.scaleX = _image.scaleY = _targetWidth / _image.width;
if ( _image.height < _targetHeight )
{
var s:Number = _targetHeight / _image.height;
_image.scaleX *= s;
_image.scaleY *= s;
}

//
// Create mask
//

var m:Sprite = new Sprite();
m.graphics.beginFill( 0xFF0000 );
m.graphics.drawRect( 0,0, _targetWidth, _targetHeight );
addChild( m );

if ( _photoCredit ) _photoCredit.mask = m;
_image.mask = m;

Tweener.addTween( _image,
{
alpha: 1,
time: 1,
delay: 0
});

}

private function imageLoadFailed( e:IOErrorEvent ):void
{
//Logger.instance.log( "Unable to load "" + _imageURL + "" error: " + e.toString(), "fords.ui.SlideshowImage" );

setChildIndex( _spinner, this.numChildren - 1 );
_spinner.setLabel( "Unable to load "" + _imageURL + "" error: " + e.toString() );
}

}

}

//////////////////////////////////////////////////
// CacheBust class

package zakariya.util {

public class CacheBust extends Object {

public function CacheBust(){
super();
}

public static function url( inURL:String, length:int = 10 ):String
{
var seed:Number = (new Date()).time;
var buster:String = "?";

for ( var i:int = 0; i < length; i++ )
{
var rand:Number = Math.random() * seed;
var letter:int = int( 97 + rand % 26 );

buster += String.fromCharCode( letter );
}

//trace( "CacheBust: "" + inURL + buster + """ );

return inURL + buster;
}

}

}

























Edited: 10/30/2008 at 06:54:01 AM by TomorrowPlusX

Trouble With Image Loader
when i insert a loader clip into another movie, the loader is there, and it seems to work, but the images seem to be loading "behind" the other movie, so all that can be seen is the bottom edge of the images. no script errors either , any help? just an idiot record exec whos a bit out of my depth, please be kind!!!

Xml Image Gallery Trouble
I'm trying to create an xml image gallery at the moment. I've made it so it works but I'm now cleaning the code and I want to separate the navigation into a class of its own. Here is the Gallery class...


ActionScript Code:
package _classes{    import flash.display.Sprite;    import flash.display.Stage;    import flash.display.StageAlign;    import flash.display.StageScaleMode;    import flash.net.URLLoader;    import flash.net.URLRequest;    import flash.events.Event;    import _classes.media.displays.ImageDisplay;    import _classes.media.controllers.ImageController;    public class Gallery extends Sprite {        private var _xmlLoader:URLLoader = new URLLoader();        private var _xmlData:XML;        public var pImageList:XMLList;        public function Gallery() {            initStage();            loadContent();        }                private function loadContent():void {            _xmlLoader.addEventListener(Event.COMPLETE, onContentLoaded);            _xmlLoader.load(new URLRequest("gallery.xml"));        }                private function initStage():void {            stage.frameRate = 61;            stage.scaleMode = StageScaleMode.NO_SCALE;            stage.align = StageAlign.TOP_LEFT;        }                private function onContentLoaded(event:Event):void {            _xmlData = _xmlData = new XML(event.target.data);            pImageList = _xmlData.image.imagePath;            initController();        }                private function initController():void {            var imageController:ImageController = new ImageController(pImageList);            addChild(imageController);        }    }}


ImageController class


ActionScript Code:
package _classes.media.controllers{    import flash.display.Sprite;    import flash.events.MouseEvent;    import _classes.media.displays.ImageDisplay;    public class ImageController extends Sprite {        private var _imageCurrPos:Number = 1;        public function ImageController(pImageList:XMLList) {                        var navBack:NavBack = new NavBack();            addChild(navBack);            navBack.x = 0;            navBack.y = 373;            var prevButton:PrevButton = new PrevButton();            addChild(prevButton);            prevButton.x = 0;            prevButton.y = 373;            prevButton.addEventListener(MouseEvent.MOUSE_DOWN, previousClick);            var nextButton:NextButton = new NextButton();            addChild(nextButton);            nextButton.x = stage.stageWidth - nextButton.width;            nextButton.y = 373;            nextButton.addEventListener(MouseEvent.MOUSE_DOWN, nextClick);            var navContainer:Sprite = new Sprite();            addChild(navContainer);            navContainer.y = 374;            for (var i:uint = 1; i <pImageList.length() + 1; i++) {                var imageElement:XML = pImageList[i];                var button:ImageButton = new ImageButton();                navContainer.addChild(button);                button.addEventListener(MouseEvent.MOUSE_DOWN, onMouseClick);                button.x = i * 18;                button.useHandCursor = true;                button.buttonText.text = String(i);            }            navContainer.x = stage.stageWidth - (navContainer.width + prevButton.width + 20);            function onMouseClick(event:MouseEvent):void {                var image:ImageDisplay = new ImageDisplay(pImageList[(event.target.text) - 1]);                addChild(image);                _imageCurrPos = Number(event.target.text);                trace(_imageCurrPos);            }            function previousClick(event:MouseEvent):void {                var image:ImageDisplay = new ImageDisplay(pImageList[_imageCurrPos - 1]);                addChild(image);                _imageCurrPos = _imageCurrPos - 1;                trace(_imageCurrPos);            }            function nextClick(event:MouseEvent):void {                var image:ImageDisplay = new ImageDisplay(pImageList[_imageCurrPos + 1]);                addChild(image);                _imageCurrPos = _imageCurrPos + 1;                trace(_imageCurrPos);            }        }    }}


I'm trying to pass a public XMLList variable from the gallery to the controller and I get this error...


Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at _classes.media.controllers::ImageController$iinit()
at _classes::Gallery/::initController()
at _classes::Gallery/::onContentLoaded()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Any help would be greatly appreciated...

David

Trouble With Xml Image Slideshow
hey guys, i have an xml based image fader, that loads four random images from four different directories and places them into four different empty movieclips. Now, first of all, I'm pretty sure that my code could me optimized, because I just copied the code and duplicated it, so maybe someone could help me out with that...

but the most important part is this: the pictures fade in, but I REALLY NEED them to also fade out before the next one is being faded in... and I cant do it....

can someone please help me out?

the code is this:


ActionScript Code:
stop();
 
var oldVar1 = 0;
var oldVar2 = 0;
var oldVar3 = 0;
var oldVar4 = 0;
var newVar1 = 0;
var newVar2 = 0;
var newVar3 = 0;
var newVar4 = 0;
 
 
 
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success) {
    if (success) {
        library1 = this.childNodes[0].childNodes;
        library2 = this.childNodes[1].childNodes;
        library3 = this.childNodes[2].childNodes;
        library4 = this.childNodes[3].childNodes;
        //time = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
        maxVal1 = library1.length;
        maxVal2 = library2.length;
        maxVal3 = library3.length;
        maxVal4 = library4.length;
        //delete my_xml;
        getImage1();
        getImage2();
        getImage3();
        getImage4();
    }
};
my_xml.load('images.xml');
 
this.onEnterFrame = function() {
    if (container1._alpha<100) {
        container1._alpha += 2;
    }
    if (container2._alpha<100) {
        container2._alpha += 2;
    }
    if (container3._alpha<100) {
        container3._alpha += 2;
    }
    if (container4._alpha<100) {
        container4._alpha += 2;
    }
};
 
function getImage1() {
    newVar1 = Math.floor(Math.random()*maxVal1);
    if (newVar1 == oldVar1) {
        getImage1();
    } else {
        oldVar1 = newVar1;
 
        container1._alpha = 0;
        container1.loadMovie(library1[newVar1].firstChild.firstChild.nodeValue);
 
        time1 = library1[newVar1].childNodes[1].firstChild.nodeValue;
        setTimeout(getImage1,time1);
        newVar1 = Math.floor(Math.random()*maxVal1);
    }
}
 
function getImage2() {
    newVar2 = Math.floor(Math.random()*maxVal2);
    if (newVar2 == oldVar2) {
        getImage2();
    } else {
        oldVar2 = newVar2;
 
        container2._alpha = 0;
        container2.loadMovie(library2[newVar2].firstChild.firstChild.nodeValue);
 
        time2 = library2[newVar2].childNodes[1].firstChild.nodeValue;
        setTimeout(getImage2,time2);
        newVar2 = Math.floor(Math.random()*maxVal2);
    }
}
 
function getImage3() {
    newVar3 = Math.floor(Math.random()*maxVal3);
    if (newVar3 == oldVar3) {
        getImage3();
    } else {
        oldVar3 = newVar3;
       
        container3._alpha = 0;
        container3.loadMovie(library3[newVar3].firstChild.firstChild.nodeValue);
 
        time3 = library3[newVar3].childNodes[1].firstChild.nodeValue;
        setTimeout(getImage3,time3);
        newVar3 = Math.floor(Math.random()*maxVal3);
    }
}
 
function getImage4() {
    newVar4 = Math.floor(Math.random()*maxVal4);
    if (newVar4 == oldVar4) {
        getImage4();
    } else {
        oldVar4 = newVar4;
 
        container4._alpha = 0;
        container4.loadMovie(library4[newVar4].firstChild.firstChild.nodeValue);
 
        time4 = library4[newVar4].childNodes[1].firstChild.nodeValue;
        setTimeout(getImage4,time4);
        newVar4 = Math.floor(Math.random()*maxVal4);
    }
}

Vertical Image Scroller Trouble
I created a vertical image scroller that moves up or down based on mouse position. I would like it to move only when the cursor is within the menu area and not outside; it will start to look distracting when their is some copy to read on the screen. I included the file so you can see how it was built.

Any help would be greatly appreciated.

Thanks in advance.

Trouble With Image/movie Quality
I am pretty new to flash and am having trouble with the quality of the text in the graphics in my swf file after I actually upload it to the hosting server. It looks fine when I test it on my computer before I upload it to the host. I have the publish settings set to 100 on the quality bar. What am I doing wrong?

Trouble With Image/movie Quality
I am pretty new to flash and am having trouble with the quality of the text in the graphics in my swf file after I actually upload it to the hosting server. It looks fine when I test it on my computer before I upload it to the host. I have the publish settings set to 100 on the quality bar. What am I doing wrong?
(I am using CS3)
Thanks for you help!
Heidihop

[CS3] Sliding Image Gallery Trouble
Hi,

I'm trying to create an sliding image gallery with ease like this: http://www.webdesign.org/web/flash-&...ing.12433.html but I would like to have only two arrow buttons back and forward but still remain the same kind of sliding with ease- function that the example has. Could someone give me a hand on how modify the code to get it work with only those two buttons?

Cheers,
Satu

Thumbnail Trouble, Image Gallery, Xml.
Hi, I'm making an image gallery and are having some issues with the thumbnails.

What I want is to be able to have thumbnails with the same height but different width.



Attached the fla.

Having Trouble With Image Fader, Stops Working
I'm using actionscript to have a few images fade in/out at the top of my main page. I'm loading it as a separate swf because I want it to go away when other pages are accessed. The problem is, if you click on "ABOUT US" more than a few times to get back to that page, the image fader stops working. A couple times it will fade the images in but not out, and then after that it just majorly messes up. I don't understand when it works fine for a couple of loads.

Here's the page: http://crimsonmedia.com/ONTHEFLY

Click on "MENUS", the only ones working as of now are "CORPORATE LUNCHES" and "DELI ITEMS". After clicking on any of them, go back to "ABOUT US". Or just load "ABOUT US" a few times. It stops working. Ugh.

Any ideas as to why this is happening?

Also I tried to post the code but it cuts off...too long for a post I guess? Here is a text link: http://crimsonmedia.com/ONTHEFLY/ontheflycode.rtf

Variable Trouble For Autommated Image Gallery
I am having a really hard time trying to set the following variable.

i have a bunch of loaded variables via an ASP page. It outputs the filenames of the number of files kept in the 'images' folder at the time the page is loaded.
it outputs the filenames setting each variable with the names:

image1=xxx.jpg&image2=xyz.jpg&image3=jkl.jpg.

i have successfully created buttons corresponding to the number of images conatined in my folder. I now need to figure out how i can set

photo = myData.image+i (this is value of the filename of my image)

this is for use in the same loop which creates buttons automatically.

The idea is that if it loops through the values of image1 etc the value, which is the full name of the file will be addedaccordingly.

here is my code :


myData = new LoadVars();

myData.onLoad = function() {







image5.text= myData.image5;
filepath = "http://123.123.123/FLASHASP/images/";
numButtons = myData.imagecount;
X = 10;
Y = 10;
for (i=1; i<=numButtons; ++i) {

_root.attachMovie("button", "button"+i, i);
buttons[i] = _root["button"+i];
_root["button"+i].index = i;
_root["button"+i].num = i;
_root["button"+i]._x = (i*X)*4;
_root["button"+i]._y = 20;
_root["button"+i].onPress = function () {
_root.createEmptyMovieClip("container",300);
mydatavalue = myData.image+[i];
container.loadMovie(filepath+mydatavalue, "container");
container._x =200;
container._y = 50;
}
}
}

myData.load("default.asp");


If Anyone can help out here, I will be very greatful and will definitely shar the fruits when i turn it into a component!!!!!

Trouble With Flash Image Gallery And Thumbnails
I originally tried to make this photopage work in flash6, but I just upgraded to 8 and I still cannot get it working. The normal photo window and buttons work fine, but the thumbnails fail to show up at all. I have gone through Kirupa's awesome tutorials to get to this point, but I just cannot get my head around why the thumbnails are just completely failing for me. Would someone mind grabbing my .fla and trying to find what mistake I have made. I am completely at a loss ;;. Thanks.

http://www.levelforge.planetquake.ga...dailyphoto.zip

Variable Trouble For Autommated Image Gallery
I am having a really hard time trying to set the following variable.

i have a bunch of loaded variables via an ASP page. It outputs the filenames of the number of files kept in the 'images' folder at the time the page is loaded.
it outputs the filenames setting each variable with the names:

image1=xxx.jpg&image2=xyz.jpg&image3=jkl.jpg.

i have successfully created buttons corresponding to the number of images conatined in my folder. I now need to figure out how i can set

photo = myData.image+i (this is value of the filename of my image)

this is for use in the same loop which creates buttons automatically.

The idea is that if it loops through the values of image1 etc the value, which is the full name of the file will be addedaccordingly.

here is my code :


myData = new LoadVars();

myData.onLoad = function() {







image5.text= myData.image5;
filepath = "http://123.123.123/FLASHASP/images/";
numButtons = myData.imagecount;
X = 10;
Y = 10;
for (i=1; i<=numButtons; ++i) {

_root.attachMovie("button", "button"+i, i);
buttons[i] = _root["button"+i];
_root["button"+i].index = i;
_root["button"+i].num = i;
_root["button"+i]._x = (i*X)*4;
_root["button"+i]._y = 20;
_root["button"+i].onPress = function () {
_root.createEmptyMovieClip("container",300);
mydatavalue = myData.image+[i];
container.loadMovie(filepath+mydatavalue, "container");
container._x =200;
container._y = 50;
}
}
}

myData.load("default.asp");


If Anyone can help out here, I will be very greatful and will definitely shar the fruits when i turn it into a component!!!!!

Trouble Animating/masking Dynamic Image
Hi,

does somebody know how to animate a mask over a dynamicly loaded image? Or does anybody have an example or something? I just can't get it fixed.

T

Copyright © 2005-08 www.BigResource.com, All rights reserved