GetBytesTotal Returns Wrong File Size...
my file size is 42KB yet getBytesTotal returns as 83K.. is this a bug?
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 09-22-2004, 02:12 AM
View Complete Forum Thread with Replies
Sponsored Links:
GetBytesTotal() Reporting Wrong Size?
When I use getBytesTotal() I don't seem to be getting the correct file size.
The file size on the drive is: 76k but getBytesTotal() returns: 132k
Am I missing something?
I could have sworn when I wrote this script that is worked now it doesn't?
Code:
bytes = Math.round(getBytesTotal()/1000);
//is it 1000 or 1024? still doesn't make a significant difference!!!!
trace(bytes);
View Replies !
View Related
GetBytesTotal() Is + ASP File.Size - WHY?
I'm trying to build a multiple preloader, so I need to know the size of all files I'll be preloading.... but...
it seems getBytesTotal() from flash is not correct...
does anybody know something about it?
ASP CODE (the same size as windows)
Code:
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fileq = fs.GetFile(Server.MapPath(arquivo))
Response.Write(fileq.Size)
View Replies !
View Related
GetBytesTotal() Returns -1 ?
I've got a clip called ImageContainer and within a clip called Image. On the root timeline I have a loadMovie command that loads a movie into _root.ImageContainer.Image
I am trying to preload the content into Image, but on displaying getBytesTotal() for the image it returns -1. Anyone know what I am doing wrong?
The code to display the total bytes is inside ImageContainer i.e. this.Image.getBytesTotal();
Thanks
View Replies !
View Related
GetBytesTotal Returns 0
This is really doing my nut, i'm preloading an external jpg into a movie on my stage, with a preloader on the main stage rather than the loaded movie, but it always return 0 to getBytesTotal(). Here's the code:
Code:
_root.createEmptyMovieClip('holder', 2);
holder.loadMovie("img1.jpg");
holder._x = 50;
holder._y = 50;
var l = holder.getBytesLoaded();
var t = holder.getBytesTotal();
if (l<t) {
this.texttotal.text = Math.round(t/1000)+'kb total';
gotoAndPlay (1);
} else {
// fully loaded
this.texttotal.text = "loaded";
//this._visible = false;
}
View Replies !
View Related
GetBytesTotal Returns 0
This is really doing my nut, i'm preloading an external jpg into a movie on my stage, with a preloader on the main stage rather than the loaded movie, but it always return 0 to getBytesTotal(). Here's the code:
Code:
_root.createEmptyMovieClip('holder', 2);
holder.loadMovie("img1.jpg");
holder._x = 50;
holder._y = 50;
var l = holder.getBytesLoaded();
var t = holder.getBytesTotal();
if (l<t) {
this.texttotal.text = Math.round(t/1000)+'kb total';
gotoAndPlay (1);
} else {
// fully loaded
this.texttotal.text = "loaded";
//this._visible = false;
}
View Replies !
View Related
GetBytesLoaded Returns GetBytesTotal...
Okay what I am trying to do should be pretty simple... I've done it quite a few times before but I'm getting nowhere this time. Here's my setup.
I have a main swf that simply is used to load other swfs as links are clicked. Now two different swfs are always loaded at the same time. One is a banner that contains the menu which is never unloaded. And the other is the content swf that is changed as the links are clicked.
Here's the setup: It's not as optimized as it could be because I've been messing it up continuously trying to find the problem.
Code:
//SNIPPET: this is in the banner.
if (loading) {
loading = _root.checkLoading();
if (!loading) {
turnOn();
}
}
//SNIPPET:this is in the main swf
function checkLoading() {
var rbool:Boolean = true;
var loaded:Number = content.getBytesLoaded();
var total:Number = content.getBytesTotal();
lbar.lbar._xscale = loaded/total*100;
lbar.perc = loaded;
if (total == loaded && total > 1) {
rbool = false;
}
return rbool;
}
//SNIPPET: Last here's the setup for content which is also in the banner
if (_root.chg == "2d") {
loadMovie("2dViewer.swf", _root.content);
} else if (_root.chg == "3d") {
loadMovie("3dViewer.swf", _root.content);
} else if (_root.chg == "web") {
loadMovie("webViewer.swf", _root.content);
} else if (_root.chg == "contact") {
loadMovie("contact.swf", _root.content);
} else if (_root.chg == "about") {
loadMovie("about.swf", _root.content);
} else if (_root.chg == "home") {
loadMovie("main.swf", _root.content);
}
Okay now here's my problem. content.getBytesLoaded() returns the same as content.getBytesTotal(). And no it's not 0... it's a large amount of bytes that I am assuming is the actual Total. And it's not loaded yet either, one of the swfs is about 2.5 megs and says it is loaded but it's not even close...
Am I doing something stupid? Probably... if you can help me that would be awesome! In the mean time... I'll scratch my brain some more...
View Replies !
View Related
GetBytesTotal = Wrong Value For LoadMovie?
I'm trying to get the total bytes of an externally loaded .swf file using...
trace(_root.holder.getBytesTotal());
//holder is the MC it's loaded into.
The filesize is 26K, yet Flash tells me it's 31. Similarly, with another file which is 39K, Flash tells me it's 44, so it's adding five each time which will obviously slow down the pre-loaded process, i.e. if it thinks it has to load more than it actually does
Q'eh??
View Replies !
View Related
StageHeight Returns Wrong Value
Hi guys,
I'm finally making the jump to AS3 and am pressing through, so thanks for any help here (I always search first).
Writing a custom Document Class for my app. I'm just setting up a simple GUI so far with a header bar, tool bar, and background using the drawing API. But, when trying to position dynamically, I can't seem to get the correct dimension of my stage height. It keeps coming back 100px too short !?!
I'm posting the code here in hopes there's something dumb I'm doing and some one can point it out.
Thanks.
Jim.
Attach Code
//::::::::::::::::::::::::::::::::::: BEGIN CODE ::::::::::::::::::::::::://
package
{
/**
/* IMPORT CLASSES HERE
*/
/* for GUI */
import flash.display.MovieClip;
import flash.display.Graphics;
import flash.display.Shape;
import flash.display.GradientType;
import flash.display.SpreadMethod;
import flash.display.InterpolationMethod;
import flash.geom.Matrix;
/* for Events */
import flash.events.Event;
/**
/*CONSTRUCTOR
*/
public class pslMapDocument extends MovieClip
{
// DECLARE PRIVATE + PUBLIC VARS HERE
private var sW:int = this.stageWidth;
private var sH:int = this.stageHeight;
private var bkgdColor:uint = 0x333333;
private var toolBarColor:uint = 0x3b6994;
private var hgradColor1:uint = 0xffffff;
private var hgradColor2:uint = 0xdddddd;
public function pslMapDocument():void
{
initGUI();
}
// ADDITIONAL METHODS GO HERE
private function initGUI():void
{
trace(sH); // <------ THIS GIVES WRONG RESULT BY 100px
/**
/*Create Background Fill (for testing purposes)
*/
var bkgd:Shape = new Shape();
bkgd.graphics.beginFill(bkgdColor);
bkgd.graphics.drawRect(0, 50, sW, sH);
bkgd.graphics.endFill();
addChild(bkgd);
/**
/*Create Tool Bar
*/
var tool_bar:Shape = new Shape();
tool_bar.graphics.beginFill(toolBarColor);
tool_bar.graphics.drawRect(0, sH, sW, 40);
tool_bar.graphics.endFill();
addChild(tool_bar);
/**
/*Create Header Bar
*/
var header_bar:Shape = new Shape();
var matr:Matrix = new Matrix();
var rot:Number = Math.PI/2;
matr.createGradientBox(this.stage.stageWidth, 50, rot, 0, 0);
header_bar.graphics.beginGradientFill(
GradientType.LINEAR,
[hgradColor1, hgradColor2],
[1, 1],
[0,255],
matr,
SpreadMethod.PAD,
InterpolationMethod.LINEAR_RGB,
0);
header_bar.graphics.drawRect(0, 0, this.stage.stageWidth, 50);
header_bar.graphics.endFill();
addChild(header_bar);
}
}
}
View Replies !
View Related
GetBytesTotal() - Get Real SWF Size
I have read on the Flash 8 documentation and these forums that the value given by the function getBytesTotal does not reflect the real SWF size of your movie, but instead, it gives you the value for the uncompressed SWF file.
Is there a way where I can retrieve the EXACT, real value of the SWF file size on disk?
Thanks !
View Replies !
View Related
GetBytesTotal Reports Incorrect Size
i have made my preloader.
in my preloader, i show on screen to the user the filesize of my .swf
however the size it reports is different from the physical size on my harddrive.
ie. on harddrive it is 440kb, using getBytesTotal it shows 965kb
even if i keep to the very basics, it reports the filesize incorrectly.
Where does it get the information from? internally?
any ideas?
cheers
View Replies !
View Related
Array Size Returns 0
I'm having some issues with the following code:
Code:
gallery_category = "Category Number 1";
gallery_conf_file = "gallery.txt";
gallery_titles = new Array();
gallery_sizes = new Array();
gallery_descriptions = new Array();
gallery_thumbnails = new Array();
gallery_images = new Array();
gallery_popups = new Array();
var l = new LoadVars();
l.onLoad=function(done) {
if(done) {
gallery_titles = this.gallery_titles.split(", ");
gallery_sizes = this.gallery_sizes.split(", ");
gallery_descriptions = this.gallery_descriptions.split(", ");
gallery_thumbnails = this.gallery_thumbnails.split(", ");
gallery_images = this.gallery_images.split(", ");
gallery_popups = this.gallery_popups.split(", ");
}
};
l.load(gallery_conf_file);
trace("Images ->");
trace(gallery_titles.length);
The length of the array gallery_titles always returns 0. The array is populated though showing the correct data from the text file when I run the debug movie thingy. The arrays seem to be on _level0 - is this OK? though even when I use trace(_level0.gallery_titles.length); It still returns 0.
Any help would be fantastic - cause I cant really get any further with this project until I can get to the array size :-(
View Replies !
View Related
Checking For File Using GetBytesTotal();
I have been trying to get my code to see if a jpg file exists. However, the code below does not work because if the file isn't there, my output window just says Error opening URL. Any suggestions for checking for file existence? I would like to use an if() statement after checking for a file, so that if the file doesn't exist, load this file instead.
var imagebytes:Number = getBytesTotal (path);
if (imagebytes < 1) {
imagenum = 1;
}
View Replies !
View Related
GetBytesTotal For File Without Loading-4 Podcast
Hello kirupa...
So i am building a dynamic podcast creator with flash (and mySQL, amfPHP) for a client who is not a tech person at all.
The podcast will update itself through the CMS we are building for him.
For an iTunes podcast however, i need to include the length of each podcast item in bytes.
Is there a way i can get the file size of the mp3 without fully loading it into a Sound object?
Anybody know? I dont think My client will be able to get and fill in the length in bytes for each entry, so i need a way to do this behind the scenes.
I would like to think that there is a way to do this other than storing the "bytes total" in the database when the client uploads the mp3 through the flash CMS.
ANy help would be hugely appreciated.
View Replies !
View Related
GetBytesTotal() And GetBytesLoaded() Not Working When Loading Jpg File Into MC...hlp
Using MX, anyone see a problem with getBytesLoaded() and getBytesTotla() not being returned correctly using this code? Does not work for me. movBirdContainer is just an empty mc with 1 empty frame.
Code:
movBirdContainer.createEmptyMovieClip("movBird", 1);
movBirdContainer.movBird.loadMovie("./image.jpg");
onEnterFrame = function()
{
// Preloader code
var nLoaded = Math.round(movBirdContainer.movBird.getBytesLoaded() / 1024);
var nTotal = Math.round(movBirdContainer.movBird.getBytesTotal() / 1024);
trace("total bytes loaded is: " + nLoaded);
trace("total bytes is: " + nTotal);
trace("percent loaded is: " + Math.round((nLoaded / nTotal) * 100));
}
View Replies !
View Related
[Q] How Reliable Is It To Check The File Existence With The GetBytesTotal()?
Just out of curiosity...
How reliable is it to check the file existence with the getBytesTotal() function returning -1???
For example...
PHP Code:
this.loader_mc.loadMovie("blahblah.jpg");
this.onEnterFrame = function ()
{
if (this.loader_mc.getBytesTotal() == -1)
{
delete this.onEnterFrame;
trace("File does not exist!!!");
}
else
{
// your normal loader routine here...
}
}
So far, it looks like the above routine detects the file existence, but I want to hear from somebody else on this...
Thank you...
View Replies !
View Related
Scene File Size Huge Compared To Seperate Movie File Size?
I have a flash movie with multiple swf files imported into different movieclips throughout. Each of the imported movieclips is a seperate scene of the original movie. The thing I found out is that if I copy all the frames of scene 2 for example, and paste them into a new movie. Then publish the new movie as a swf. The file size is much smaller than the scene 2 swf when published from the original movie. Does anyone know why?
View Replies !
View Related
Is There A Way To Ignore Hard Returns In A Txt File?
I have a flash banner scrolling one line of text from a txt file from right to left (like a news ticker).
Problem is, if there is a hard return in the txt file then i get a two lined paragraph of text scrolling across now.
Is there anyway i can make flash ignore the hard return in the txt file?
Quote:
my code:
var x = read_txt.textWidth;
this.createTextField("display_txt", 0, Stage.width, 20, x, 20);
display_txt.text = read_txt.text;
display_txt.autoSize = 'left';
display_txt.multiline = false;
display_txt.wordWrap = false;
display_txt.setTextFormat(formatObj);
onEnterFrame = function() {
display_txt._x -= 4;
if (display_txt._x <= -display_txt._width) {
display_txt._x = 650;
}
}
stop();
View Replies !
View Related
Is There A Way To Ignore Hard Returns In A Txt File?
I have a flash banner scrolling one line of text from a txt file from right to left (like a news ticker).
Problem is, if there is a hard return in the txt file then i get a two lined paragraph of text scrolling across now.
Is there anyway i can make flash ignore the hard return in the txt file?
Quote:
my code:
var x = read_txt.textWidth;
this.createTextField("display_txt", 0, Stage.width, 20, x, 20);
display_txt.text = read_txt.text;
display_txt.autoSize = 'left';
display_txt.multiline = false;
display_txt.wordWrap = false;
display_txt.setTextFormat(formatObj);
onEnterFrame = function() {
display_txt._x -= 4;
if (display_txt._x <= -display_txt._width) {
display_txt._x = 650;
}
}
stop();
View Replies !
View Related
Function That Reads And Returns A Value From An XML File
Hi,
I've been able to read an XML file using the following code but the problem is that the function "clientInfo" always returns noting. The issue is that Flash doesn't wait until the XML load is done and continues executing the next line which in this case is the function return. Is there a way to create a function that reads a value from an XML file and returns it?
Thanks
Attach Code
function clientInfo(clientObj)
{
var theXML = new XML();
var clientName = "";
theXML.ignoreWhite = true;
theXML.onLoad = function()
{
var nodes = this.firstChild.childNodes;
if(this.firstChild.firstChild.nodeName != "exception")
{
clientName = nodes[0].childNodes[0].firstChild.nodeValue + " " + nodes[0].childNodes[1].firstChild.nodeValue;
}
}
theXML.load("client.xml");
return(clientName);
}
var clientObj:Object = new Object();
clientObj.clientID = "1152288648396";
trace("Return value: "+clientInfo(clientObj));
View Replies !
View Related
File Upload Returns IoError #2038
I'm getting an error when uploading...
openHandler: [Event type="open" bubbles=false cancelable=false eventPhase=2]
progressHandler: name=test.txt bytesLoaded=657 bytesTotal=657
openHandler: [Event type="open" bubbles=false cancelable=false eventPhase=2]
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2038"]
my uploading.php file should be fine (tested with a htmlform).
anyone know what could be wrong?
my test code:
Code:
package {
import flash.display.* ;
import flash.events.*;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.system.Security;
import flash.system.SecurityPanel;
import flash.net.URLRequestMethod;
import flash.net.FileFilter;
public class UploadClass extends Sprite {
private var uploadURL:URLRequest;
private var file:FileReference;
private const _strUploadDomain:String = "";
private const _strUploadScript:String = _strUploadDomain + "uploading.php";
public function UploadClass() {
uploadURL = new URLRequest();
uploadURL.url = _strUploadScript;
uploadURL.method = URLRequestMethod.POST;
file = new FileReference();
file.addEventListener(Event.SELECT, selectHandler);
file.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
file.addEventListener(ProgressEvent.PROGRESS, progressHandler);
file.addEventListener(Event.COMPLETE, completeHandler);
file.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
file.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
file.addEventListener(Event.OPEN, openHandler);
var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
var textTypes:FileFilter = new FileFilter("Text Files (*.txt, *.rtf)", "*.txt; *.rtf");
var allTypes:Array = new Array(imageTypes, textTypes);
file.browse(allTypes);
}
private function selectHandler(event:Event):void {
var file:FileReference = FileReference(event.target);
trace("selectHandler: name=" + file.name + " URL=" + uploadURL.url);
dt1.text = "selectHandler: name=" + file.name + " URL=" + uploadURL.url;
file.upload(uploadURL);
}
private function httpStatusHandler(event:HTTPStatusEvent):void {
dt5.text = "httpStatusHandler: " + event;
trace("httpStatusHandler: " + event);
}
private function openHandler(event:Event):void {
dt6.text = "openHandler: " + event;
trace("openHandler: " + event);
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
dt7.text = "securityErrorHandler: " + event;
trace("securityErrorHandler: " + event);
}
private function ioErrorHandler(event:IOErrorEvent):void {
dt2.text = "ioErrorHandler: " + event;
trace("ioErrorHandler: " + event);
}
private function progressHandler(event:ProgressEvent):void {
var file:FileReference = FileReference(event.target);
dt3.text = "progressHandler: name=" + file.name + " bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal;
trace("progressHandler: name=" + file.name + " bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
}
private function completeHandler(event:Event):void {
dt4.text = "completeHandler: " + event;
trace("completeHandler: " + event);
}
}
}
View Replies !
View Related
Loading Carriage Returns From A File Into A Dynamic Text Box
Hi all,
Anyone got some suggestions on how to get carriage returns into a dynamic text box? I load the variables in from a file (I could substitute a special char for a carriage return), what I don't know how to do is change the value to a carriage return.. (I need this to work in Flash 4 and Flash 5)
Any help will be appreciated.
Thanks in advance
Shaun
View Replies !
View Related
Irritating Hard Returns While Loading From Text File
Hi all,
There is probably a very easy solutions but I just don't know what it is. I'm trying to load a little poem from a text file but I'm having difficulties with the returns. The poem in the .txt file goes like this (it's dutch):
&gedicht=Lourdes
Je bent bedevaarder
en je wilt wat
maar wat je krijgt
is wat de ander had.
Hetzij...
-------
and so on. But in Flash it looks like this:
Lourdes
Je bent bedevaarder
en je wilt wat
maar wat je krijgt
is wat de ander had.
Het zij...
-------
and so on. THIS IS VERY IRRITATING!! Does anyone know how I can solve this? I do not wish to use HTML codes because I will update this text file very often and other poems will be updated trough the Internet by visitors.
So how can I do this simple with text files?
Godfried van Loo
Utrecht, The Netherlands
View Replies !
View Related
Preserving Carriage Returns When Writing To External Text File
Hey Flashkit,
This message is both a "How to" and also a question is there a better way to do this?
My project writes text from an input field in Flash to an external text file on a Win 2000 PC using the Flash MX/6 plugin and ASP to create and write to the file.
I want to preserve carriage returns in-between the strings written to the text file. Using
alone or <p> </p> do not work. The carriage returns appear in the text file as block characters and all of the strings are concatenated together.
Then I read a post on Flashkit that uses
in-between strings and it works. My actionscript looks something like this:
var more_txt = "a new line of text";
var body = (textBox+"
"+more_txt+"
"+more_txt+"
"+mo re_txt);
fscommand("writeToFile", body);
The text file written to displays this:
whatever you typed in
a new line of text
a new line of text
a new line of text
This is exactly the output I am looking for. So now my question to Flashkit is there a better way of doing this?
Thanks buds,
- Jimmy
View Replies !
View Related
Loading External Text File Returns Error: #2032 ..but On One Server It Works.
Hello, it has been a while before i did something with actionscript again, but
does anyone know if there has been some changes about loading external text files in Flash?
I tried loading an external text file from a online webserver that worked fine. But now i wanted
to move the text file to a different webserver and i got this error:
Error opening URL 'http://wwww.uniqwebdesign.com/mailform_test/dataformcs.txt'
httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=401]
and:
status: 401
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL:
View Replies !
View Related
LoadMovie Gives Me The Wrong Size Swf
Hey, I am trying to use a main movie to control the navigation into which I have a blank movieclip. External swf files will replace this blankMovie. It kind of works except that the swf files get much bigger (height/width) ? It seems like I have no control over this. Is there a way that I can control/maintain the orginal dimensions?
Thanks in advance
Vik.
View Replies !
View Related
Printing Wrong Size Please Help
I have a dynamically loaded jpg that loads into a mc container that stretches to fit the new loaded jpg. The problem is when I use the printAsBitmap function it doesn't print the correct size. Inside the container mc I have a solid color on the first frame on that frame I have the label #b this would be my bounding box. But it just ignores this. If you check out this link and try it it prints the size of a letterhead not the size of the original photo.
Please can someone help?
Code:
print_btn.onRelease = function() {
printAsBitmap(_root.container, "bframe");
};
LINK TO PRINT FILE
YOU CAN DOWNLOAD THE FLA FILE TO HAVE A LOOK AT HOW I HAVE DONE IT.
LINK TO ZIPPED FILE
View Replies !
View Related
Loading Swf, Wrong Size?
action script 2 (mx)
hi guys
im trying to load a swf , and it works but it seems to be half the size, has any one got any ideas to whats wrong, I have tried this code, but it still comes out half the size:
onClipEvent (enterFrame) {
if (this._width>0) {
with (this) {
_width = 700;
_height = 350;
}
}
}
so i dont know.... thanks for your time, sam
View Replies !
View Related
[F8] Loaded Swf Wrong Size
Dear All
I want to load a swf into a loader componant. I want it to be half size on the stage. I have been having problems getting it the right size.
I drag the loader element onto the stage, and set its size to 200x142 (which is half size). I then set the path and the resize in the parameters.
WHen I test it comes out twice as big - ie back to normal. If I set the size to 400 x 284 it comes out twice as big again ie around 800px.
ISo in the end I went with 100X 71 option and published inside a html page the first time it loads its tiny tiny and then if you press F5 it reloads but the correct size (ie 200X142 - half size - which is what I want...)
Help!!! What's going on.
the offending beast can be viewed at http://www.ee-web.co.uk/indexLoader.html. Press on the link "joseph storehouse". its the tiny slide show that appears half way down on the left.
would really appreciate any help
Thanks
Edward
View Replies !
View Related
Wrong Size Webcam...
Hi,
A quick problem that someone could probable easily solve -
I have a webcam video object, and a snapshot button, that when pressed, should capture a still image from the webcam onto a bitmap, which is copied to a movie clip. This code all works perfectly.
My problem is that although I have set the webcam at a high quality and large size, and the bitmap and movieclip settings the same size, the webcam captures a very small image.
This is really confusing, as I haven't specified those small dimensions anywhere.
What am I doing wrong? Any suggestions at all would be helpful!
Thanks,
Tommm
View Replies !
View Related
Font Size Is Wrong
I've managed to complete one of the tutorials http://www.compassion-in-business.co.uk/test/pub-menu.html but the font is too small. I've specified Verdana as the font face and the heading should be 14pt bold and the main text 12pt but they are a lot smaller. Can anyone suggest where I've gone wrong please?
View Replies !
View Related
Image Size (what Am I Doing Wrong?)
hi guys,
this for sure is a stupid question but i dont understan what i'm doing wrong.
somewhere in another file i just do:
lets assume _imgAutoCreate==true
Code:
private var imgCont:Image = new Image();
if (_imgAutoCreate == true) {addChild(imgCont);}
imgCont.init(_imgAutoCreate, _scrollerPos, _thumbSize);
then on the Image Class
Code:
package {
import flash.display.Bitmap;
import flash.display.Loader;
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.Event;
import flash.net.URLRequest;
/**
* ...
* @author Default
*/
public class Image extends Sprite{
private var _scrollerPos:String;
private var _autoCreate:Boolean;
private var _scrollerSize:int;
public function Image() {
}
public function init(autoCreate:Boolean, scrollerPos:String, scrollerSize:int):void {
_scrollerPos = scrollerPos;
_autoCreate = autoCreate;
_scrollerSize = scrollerSize;
if (_autoCreate == true ) { drawBack();}
}
public function loadFirst(image:String):void {
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);
ldr.load(new URLRequest(image));
}
private function onImageLoaded(e:Event):void {
//TRACE:First image
trace("first image loaded");
dispatchEvent(new Event("FirstImageLoaded"));
var img:Bitmap = e.target.content;
addChild(img);
trace(this.width);
trace(this.x);
}
private function drawBack():void {
var back : Shape = new Shape();
back.graphics.beginFill(0x000000);
back.graphics.drawRect(0, 0, 50, 50);
back.graphics.endFill();
addChild(back);
//TRACE: ImageBAck Added
trace("Image back added");
setDisplaySize();
}
private function setDisplaySize():void {
switch (_scrollerPos) {
case "bottom":
this.width = stage.stageWidth - (stage.stageWidth * 0.1);
this.height = (stage.stageHeight - _scrollerSize) - (stage.stageHeight*0.15);
this.x = (stage.stageWidth * 0.5) - (this.width * 0.5);
this.y = (stage.stageHeight * 0.05);
break;
case "top":
break;
case "left":
break;
case "right":
break;
}
//TRACE: set imageCont Size
trace("Set image cont size");
loadFirst("images\image01.jpg");
}
}
}
For me everything seems fine. The problem is that when i put the "img" on stage it gets a lot bigger of is actual size. I thinks it is scaling proportionally with the first shape i put on stage the (back.graphics.drawRect(0, 0, 50, 50).
The idea was add a Sprite(Image class) to stage, set the size of the Sprite(using the shape to set its size), add some image(var img:Bitmap = e.target.content to this Sprite(class).
Can someone plz help me? i don't unserstand why the image is getting bigger, for me i see it, as just a simple thing, of adding two display objects to the same Sprite.
thanks
View Replies !
View Related
Problem: Repeated "getBytesTotal"-check (on An XML-file) Sticks?
Greetings.
I have a Problem:
a "setInterval"-triggered function reloads an external XML-file (about 1300 - 1900 Bytes) every 30 seconds.
the "onLoad" of the XML-handler of that file then checks the filesize with "this.getBytesTotal()".
the Bytesize is compared to another value stored in a variable. At startup this is set to 0, then upon every onLoad (after the check), it's overwritten with the new value.
when I try this online, it gives me the same filesize every time, no matter what I put in that XML or how long I make it.
This whole thing works easily with a different project that I used this on- and that project uses several onLoad-handlers for 6 or 7 XML files.
It works well when I try it locally. Both files are located in different folders on the server and I mapped that exact structure locally.
SWF>> one wo hreefourfiveFILE.SWF
XML>> onesixsevenFILE.XML
The SWF opens the XML with "../../../../six/seven/FILE.XML" and it works locally, as well as upon the first load (the data is displayed, no error message)... it just doesn't do the refreshing.
Or rather- it does the refreshing (it loads the file / executes the "onLoad") but the file that it retrieves seems to have the old filesize.
The other project where this example works uses the same folder-structure.
Does anyone know what might be the cause of the problem?
Thanks in advance
View Replies !
View Related
SWF Loads Wrong Size In Dreamweaver
Hi everyone! I just became a member and hope I can get some help b/c I'm desperate!
My problem is bringing swf's into dreamweaver. I've made a swf in MX that previews fine in flash & plays fine in player 6. When I bring it into a table in dreamweaver 4, however, it appears very small and totally blank. I am trying to center the swf in the webpage and I am using a 3x3 table, 100%. What could I be doing wrong here?
View Replies !
View Related
[F8] Swf Movie Wrong Size, Keeps Replaying
I have a flash movie on this page: http://74.53.227.226/~ybbnow1/whyitworks.html
with this code:
<object width="600" height="273"
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/
shockwave/cabs/flash/swflash.cab#version=8,0,0,0">
<param name="movie" value="images/mainimages/flash/girlwithtowel.swf" />
<embed src="images/mainimages/flash/girlwithtowel.swf" width="600" height="273"
type="application/x-shockwave-flash" pluginspage=
"http://www.macromedia.com/go/getflashplayer" /></embed>
</object>
The movie is the wrong size and keeps replaying over and over. I am confused because I copied and pasted the code exactly from the http://74.53.227.226/~ybbnow1/index.html page, which works perfectly fine. I keep seeing comments online about adding a "stop", but on Flash 8 none of the controls match up to the pictures in the tutorials. And the one place where I saw "stop' (on the bottom), it did not work. HELP!
View Replies !
View Related
Firefox Displays Wrong Size
Hi,
My flash file, which I have done for Flash version 7, is displaying at a smaller size in Firefix browser. Can anyone help figure out why? It works fine in IE. Here is a link to a page where I have a version 8 and version 7.
http://www.juf.org/test/videos/default.aspx?id=24790
Any help would be greatly appreciated.
Thanks
thepopguy
View Replies !
View Related
Export Images WRONG SIZE
Yet another irritating bug in CS4 (did anyone actually test this program before it was released??). Can someone please test this and see if you get the same error:
I set a Stage size of 768 x 576.
On the stage I create two layers. The bottom layer contains a rectangle with a color fill. The rectangle is the same size as the Stage: 768 x 576. It is centered, at x=0, y=0. The top layer contains other images, smaller than the stage and set in the center.
I Go to File/Export/Export Image. I choose JPG, PNG or any other format, Save. Then the dialogue box appears.
I choose "Full Document Size" at 72dpi. The dimensions display correctly as 768 x 576.
If I then choose "Minimum Image Area" the dimension CHANGES to 768 x 575!
I have tried this numerous times with several images in several files. It always occurs the same. This is ridiculous. I absolutely depend on exact measurements when exporting graphics. If I can't trust CS4 to export images properly, then I can't use it.
This was not a problem in previous versions of Flash.
View Replies !
View Related
Wrong Size When Swf Displayed In HTML ?
I have a flash/ swf file of the size 360 width and 490 height pixels.
Then I also have a HTML document loading this swf file. In Dreamweaver the HTML frame is set to 500*600 pixels thus displaying the swf file it has the wrong size. Picture and text are stretched.
How can I, via the flash/ swf file determine, that only the area 360*490 of the swf is to be displayed. This should be no matter the size of frame predefined in Dreamweaver/ HTML.
Changing the frame in HTML would obviously solve my problem. But I finally have to uploading my swf file in Lotus Notes. When trying this it gave me the wrong size. This corresponds the issue mentioned above. That is why I can not just change the HTML frame size. I need this to be managed via swf/ flash.
It this feasible ?
Hope for some help since I have spent three months on a project and have to upload next week ..... a very bad situation !!!!
Best regards
View Replies !
View Related
Swf Loads Into Loader Wrong Size
Dear All
I want to load a swf into a loader componant. I want it to be half size on the stage. I have been having problems getting it the right size.
I drag the loader element onto the stage, and set its size to 200x142 (which is half size). I then set the path and the resize in the parameters.
WHen I test it comes out twice as big - ie back to normal. If I set the size to 400 x 284 it comes out twice as big again ie around 800px.
ISo in the end I went with 100X 71 option and published inside a html page the first time it loads its tiny tiny and then if you press F5 it reloads but the correct size (ie 200X142 - half size - which is what I want...)
Help!!! What's going on.
the offending beast can be viewed at http://www.ee-web.co.uk/indexLoader.html. Press on the link "joseph storehouse". its the tiny slide show that appears half way down on the left.
would really appreciate any help
Thanks
Edward
View Replies !
View Related
Wrong Size When Swf Displayed In HTML ?
I have a flash/ swf file of the size 360 width and 490 height pixels.
Then I also have a HTML document loading this swf file. In Dreamweaver the HTML frame is set to 500*600 pixels thus displaying the swf file it has the wrong size. Picture and text are stretched.
How can I, via the flash/ swf file determine, that only the area 360*490 of the swf is to be displayed. This should be no matter the size of frame predefined in Dreamweaver/ HTML.
Changing the frame in HTML would obviously solve my problem. But I finally have to uploading my swf file in Lotus Notes. When trying this it gave me the wrong size. This corresponds the issue mentioned above. That is why I can not just change the HTML frame size. I need this to be managed via swf/ flash.
It this feasible ?
Hope for some help since I have spent three months on a project and have to upload next week ..... a very bad situation !!!!
Best regards
View Replies !
View Related
Imported Images Wrong Size?
Hey,
Now is may seem odd (or maybe Im just missing something really obvious) but please bear with me.
Im importing images (gif, jpg and png all tried!) into flash as a background for the movie. Now I have created these in photoshop so I know they are the correct size, 130 x 84 pixels.
Once in imported into flash they appear tiny, the properties panel however says they are 130 x 84.
My movie size is 130 x 84 but is way bigger than the imported image! what the hell is going on!?!?
View Replies !
View Related
_width & _height Make MC's Wrong Size
This is completely doing my head in, brain's about to burst..
I'm trying to do a simple (i thought) animation, with a panel scaling down from the top of the movie to the bottom using actionscript in MX.
I have my MC (simply a box, w770xh550) sitting in the main timeline. It fills the full movie (770x550).
So I click it and add this code :
onClipEvent (load) {
setProperty(this,_height,0);
}
Which makes it invisible on loading.
Then I go into the MC and create a new layer above the box and add this script to the frame :
accel = 0;
speed = 10;
this.onEnterFrame = function () {
if(this._height<550){
this._yscale += speed+accel;
accel += 5;
}
}
Which makes it grow downwards across the page. The "accel" variable makes it increase in speed (easing out almost). K, this all works fine.
But if I try the same trick on a smaller bar (my nav bar - 770x15)moving in from the left BUT slower, using this code :
accel = 0;
speed = 5;
// Note the speed change.
this.onEnterFrame = function () {
if(this._width<770){
this._xscale += speed+accel;
accel += 5;
}
}
The nav bar ends up 855px wide..? Anyone got any ideas why?
I've tried using this._width += speed+accel; instead of this_xscale += speed+accel;. But this produces the same problem, all be it at a different length - 808 or so instead of 855.
Is there a full proof way to animate and scale something to an exact pixel size? Or is it easier to just script a mask across the page to simulate the actual scaling?
I'll post the fla if u need it..
View Replies !
View Related
Preloader Shows Wrong Byte Size - Please Help
Hello,
I hope this is an easy one but I can't see it.
I have a simple preloader showing this:
eg. Loading ... 23k of 419k
BUT >>> the preloader says the total number of bytes is 419k but in windows I can see the swf file is 282k.
Any ideas why? there are no external movies just 3 txt files that load in later and they are only 1k each!
This is the preloader code I am using:
Quote:
loadk = _root.getBytesLoaded() / 1000;
loadtotal = _root.getBytesTotal() / 1000;
loadSize = "Loading ... " + int(loadk) + "k of " + int(loadtotal)+ "k";
Any help much apreciated as I need to finish this today )
Cheers
AndyFlash
View Replies !
View Related
|