ActionScript 3.0 :: ByteArray Rectangle - Writing SWF Dimensions

Nov 26, 2010

I'm trying to write the RECT structure described on page 20 of the SWF specification to a ByteArray. I started with some Java code from Adobe that does the same thing (but in Java, not AS3).

This is my adaptation so far:
PHP Code:
public static function writeRect(bytes:ByteArray, rect:Rectangle):void {
bitPos = 8;
currentByte = 0;
var left:int = rect.left * 20;
var right:int = rect.right * 20;
var top:int = rect.top * 20;
[Code] .....

It seems like the right calls are being made to writeBits, because the values make sense as multiplied forms of the Rectangle dimensions:
Code:
writeBits 14 5
writeBits 0 14
writeBits 8000 14
writeBits 0 14
writeBits 5000 14
So, something seems to be wrong with how it's writing the last field (or how it does its bit/byte position bookkeeping overall), but I've been trying to debug this code for quite a while without any luck.

View 13 Replies


Similar Posts:


Actionscript 3 :: Finding An Original Rectangle's Dimensions From Rotation And Bounding Box Dimensions?

Jan 25, 2010

In AS3, I have a Sprite that has a Z axis rotation applied.How do I calculate that Sprite's dimensions (it's original size) from Sprite.rotationZ and Sprite.getRect(...)?

View 2 Replies

ActionScript 3.0 :: Getting Image Dimensions From The ByteArray

Aug 19, 2011

I have been searching in forums and I couldn't find an answer so I thought maybe I should ask.

I wrote a script that allows user to select a local file, which gets resized if it exceeds the width/height limits I specified, and finally this file gets uploaded to the server.

In documentation it writes the same max sizes for BitmapData and Loader:

Quote:

In AIR 1.5 and Flash Player 10, the maximum size for a loaded image is 8,191 pixels in width or height, and the total number of pixels cannot exceed 16,777,215 pixels. (So, if a loaded image is 8,191 pixels wide, it can only be 2,048 pixels high.) In Flash Player 9 and earlier and AIR 1.1 and earlier, the limitation is 2,880 pixels in height and 2,880 pixels in width.

So what I need is to check the file size (width and height) before I attempt to load the bytes of the file into a loader. I'm limited to the ByteArray that I get by the load of the file via a FileReference instance.

Has anybody seen a source where you can get that data out of a ByteArray prior to loading it into a DisplayObject?

View 1 Replies

Actionscript 3 :: Use The Method SetPixels(rectangle, ByteArray) Of BitmapData In Adobe Flex

Feb 3, 2011

Error #2030: End of file was encountered.

This method is not working

I am using it like this

var ba:ByteArray = new ByteArray();
ba = bmd.getPixels(bmd.rect);
bmd.setPixels(srcRect, ba);
bm.bitmapData = bmd;
img.source = bm;

View 1 Replies

Actionscript 3 :: Writing A 16bit Bytearray - Error #1502: A Script Has Executed For Longer Than The Default Timeout Period Of 15 Seconds?

Jun 16, 2011

I'm trying to write the following 16bit WAV header data into a 16bit bytearray..? Using actionscript 3.

52 49 46 46 54 00 13 00 57 41 56 45 62 65 78 74 5A 02

What i'm doing is trying to pass the correct bytearray to this mp3 encoder (http://code.google.com/p/flash-kikko/) to get it to write out an mp3. If i use their example, i can open a 16bit WAV file via filereference and pass in that bytearray to the encoder to export an mp3... but i wanna create my own bytearray and pass it in and create the mp3. Using HxD, i copied the header and footer of that same 16bit WAV file and pasted it into flash as a bytearray but when i pass it into the encoder, it freezes the compile.. and i get the error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.

View 2 Replies

ActionScript 3.0 :: Fixed Movieclip Not To Change Dimensions If The User Starts Playing With The Dimensions Of His Screen

Jan 31, 2012

What do I have to write to keep the movieclip not to change dimensions if the user starts playing with the dimensions of his screen ? I remember it was a line of as3 written at the beginning.

View 3 Replies

Actionscript 3 :: Introduce A Sound From The Library To A ByteArray (and Then Play That ByteArray)?

Feb 16, 2011

I am working on a game, made with Flash (using AS3) The game has a fast ball and when this ball hits an object it has to make a sound... but the sound starts with delay (so the ball is far away when the sound is played).This sound is edited by me and it hasn't got any silences at the beginning.The method i'm currently using is the simplest one:

public var sonidoPuntos1:sonidopunto1 = new sonidopunto1()

and then...

sonidoPuntos1.play()

I am trying to introduce the file into a ByteArray and then playing it from there...

View 2 Replies

Actionscript 3 :: Scrollbar With Sprite And Rectangle Won't Move Text, Just The Rectangle It's Painted On?

Mar 8, 2010

For those of you still with me, I am tasked with making some scrollable content in Flash. Load in a TextFile using LoadURL(), then display it. To get the text, we've written our own class TextFieldExtended, which is basically just there to give the textfile location to the constructor and then have the class do the various steps of getting it and loading it for you.So I needed to get a Scrollbar, which I got hereThe thing is, it works with Sprites.After trying to get it to accept TextFieldExtended, I bumped into a block, since the scrollbar relied heavily on a Sprite property that TextFieldExtended didn't have or could have.

So I tried adding the TextFieldExtended instance to a Sprite instance using addchild.A problem occurs here that I do not know how to handle. It seems that a Rectangle is drawn and the Text is drawn on that. I say this because the scrollbar moves the Rectangle up and down a bit, but the text doesn't scroll, just the Rectangle it is positioned in and the text then moves along with it.My question: can this be fixed, or is does this implementation of scrollbars need a lot of adaptations before this is possible?

View 1 Replies

Draw Rectangle Should See Little Bold Circle To Indicate A Perfect Rectangle

May 20, 2009

I draw a rectangle i should see a little bold circle to indicate a perfect rectangle, I seemed to lost mine, can somebody please tell me how to get it back!

View 2 Replies

ActionScript 3.0 :: Convert Wav ByteArray To Mp3 ByteArray?

Mar 28, 2011

I know its a true Pain but does anyone know any way to convert wav ByteArray to mp3 ByteArray.

View 1 Replies

ActionScript 3.0 :: Convert Rectangle To Curved Rectangle?

Aug 2, 2011

I am trying to convert a rectangle(actually multiple rectangles) to a curved rectangle. I think it should be pretty easy but I guess i am stupid. Basically I would have a start position and stop position (many of these), and they would be converted to curved rectangles and follow in a cicrle around.

View 0 Replies

ActionScript 3.0 :: Creating A Rectangle Inside Of A Rectangle?

Jun 26, 2010

I would like to create a rectangle inside of a rectangle, starting approximately 15% inward from the right side of the other rectangle.

I know how to create rectangles with:

Code:
var newHotRect:MovieClip = new MovieClip();
newHotRect.graphics.beginFill(0x00FF00);
newHotRect.graphics.drawRect(0, 0, 100, 100);
addChild(newHotRect);

But how would I make another rectangle on top of that (the black one pictured) that is approximately 15% from the right?

I toyed around with .right, and .bottomright with no success. Can anyone lead me in the right direction? or even finding the x and y of the upper right or bottom right side of a rectangle?

View 10 Replies

ActionScript 3.0 :: Rectangle To Rectangle Collision Response?

May 20, 2011

how to respond when a rectangle hits another rectangle? I already know how to detect the collision, I just don't know how to respond to it. I'm just trying making a simple side-scrolling platform game where I have platforms I can walk on and bump against on all sides. I have searched everywhere and just can't find the tutorials I'm looking for.

View 6 Replies

IDE :: Oval / Rectangle Tool And Oval / Rectangle Primitive Tool

Nov 14, 2010

I do know how to use the oval / rectangle and oval / rectangle primitive tools in the tool bar and find them quite useful, but one thing I find confusing is. A oval / rectangle primitive object can be edited later but the oval / rectangle can't. So the point is,how do we use them properly ? when to use ? Why does Adobe Flash still keep the oval / rectangle tool in their product instead of removing them with the oval / rectangle primitive tool ?

View 2 Replies

Dimensions For IOS App

Jan 24, 2011

I have a flash app for web which is 971x570. I am planning to make it into iOS app and was wondering if I can do it with 971x570 dimensions or will have to use 480x320 px dimension as provided in the iOS template in Flash CS5 and thus modify my content.

View 1 Replies

IDE :: Writing To XML File?

Apr 3, 2006

I have an menu for user to populate it. Then when the user finish, I would like to store his Order into an XML database. I do not know how to write to XML file in Flash.

View 9 Replies

ActionScript 3.0 :: Set The Dimensions Of The Swf?

May 16, 2010

I have two swf files.  I want to place one within the other.  Is there anyway I can set the dimensions of the swf I place within the other one?  I would have published it a smaller size, but it dont allow me to change the size in the settings of a swf, just the html version.

View 10 Replies

Make New Dimensions Go Up Not Down?

Apr 16, 2011

When I change the dimensions on a document, and for example make it taller, the background becomes taller in the direction DOWN. But.. how do I make it go up, if you know what I mean? When I make the dimensions taller, why cant it increase up?

View 1 Replies

Get The Banner To Act Within Its Dimensions (468 Px By 100 Px)?

Jan 29, 2009

the banner i just created was the size of my browser when i opened it on the internet, how do i get the banner to act within its dimensions (468 px by 100 px)

View 1 Replies

ActionScript 2.0 :: Getting Dimensions Of A JPG?

Jul 4, 2005

I want to load an image using loadMovie,.. and then dynamically draw a border arround it... but i need to get the dimensions of the pic... I dont know why bt using _root.container.img.pic._width isn't working... I mean it is drawing the border but very small and not even close to the dimensions of the pic. What can I do ?

(Maybe i'm trying to get the dimensions before it's loaded ??...)

View 7 Replies

ActionScript 2.0 :: Get Dimensions Of A JPG?

May 18, 2009

I have a long log in a simple TextField, simply adding new lines of text when needed. I wanted to make some of the lines different color but while adding new line (simply as myTextField.text += '' + log; ) all the previous text formatting is erased. There is a tiny note in the doc:Notice that any text inserted manually by the user, or replaced by means of the replaceSelectedText() method, receives the text field's default formatting for new text, and not the formatting specified for the text insertion point.If I get it right the I want to load an image using loadMovie,.. and then dynamically draw a border arround it... but i need to get the dimensions of the pic...I dont know why btusing_root.container.img.pic._width isn't working... I mean it is drawing the border but very small and not even close to the dimensions of the pic.

View 3 Replies

ActionScript 3.0 :: Writing To Xml Files?

Nov 27, 2009

I'm making a simple flash game as sort of a test, and I'd like to have save files by making flash write information to an xml file. Is there anyway to generate and edit an xml file using actionscript?

View 5 Replies

Writing The Data Locally?

Mar 19, 2010

I have been struggling with this all week now. I am using as3 and within my movie I have a dynamic text box that contains a score.I need this score to be written to a text file preferbly in an array that only stores the highest 5 scores.I then need values from the array to be read and displayed on another movie which will act as a high score table. e.g. I will have a dynamic text box in my high score move that will display the 1st value in the array, and then the 2nd etc.

writing/reading data to text files.Alternatively if anyone else can suggest another method for a high score table please let me know. I only need a basic high score table that runs on a users local machine as the app i am making is desined to run on individual users machines.

View 1 Replies

ActionScript 3.0 :: Writing To Xml File?

Mar 27, 2010

i load in xml file so i can read the data. i've figured out how to add, delete and modify data. but the problem is, is that even when i do that it only does it within flash it doesn't make the changes to the actual file.so i want someone to help me do this. so please help i've been at this for week and its time i ask you nice and incredibly smart people.

here is my file, its clean and organized as its something i whipped up for the sake of figuring this out.i found this, people say it allows you to save the xml data, which would work, if i have to delete a file i can do that, i know how to do that. the script i found to do this is below incase it helps you guys to help me.

Code:
package com.hodgedev.xmlcreator
{
import flash.display.Sprite;
import flash.events.Event;

[code]....

View 5 Replies

ActionScript 3.0 :: Writing An Irc Client?

Nov 24, 2010

i'm running into major problems with writing an irc client, it works perfectly when i execute it through flash, but when i upload it to a site, it won't connect, i understand that i need an crossdomain file, i've been doing alot of research, and can't make head's or tails

debugging shows that even though i do: Security.loadPolicyFile("http://example.com/crossdomain.xml");, it still attempts to read an crossdomain file from the target irc server, however, i don't have control over the target machine(nor should that be necessary), how do i get around this, or what am i doing wrong?

what i really need, is a simple example of connecting to an server that i don't control to load some resources(i.e grabbing an image), where all the crossdomains file's sit, and how it's generally done, googling around, it seems this information isn't as easy to come by as i thought

edit: also, i'm using raw sockets to connect to the irc server, if that makes a diffrence edit: alright, been reading alot more information, it looks like i do need to have a policy file to connect to said server, which is beyond retarded, please, someone tell me there's a way around this, but that doesn't explain why it works through flash?

View 2 Replies

ActionScript 3.0 :: Writing Xml From An .exe File

Jul 14, 2009

is it possible to post to php in an .exe file instead of a .swf displayed inside a browser? If so, how? I figured if you just created the .exe on the server with the .php file in the same folder it would read it and work fine.

View 2 Replies

ActionScript 3.0 :: Writing XML Data Using ASP.Net?

Jun 11, 2010

I have successfully written my XML from flash to the server using php. But now I need to have it write to a Windows server using either asp or asp.net. Below is my code for PHP.Have searched allot of places and found how to write text files and lines inside text files.But I use a URL variable to write my XML file name out with xml data I created in Flash as3.For simplicty I am using localhost... but really is set to my web domain.On the address line I pass: Example

PHP CODE
<?phpif (isset($GLOBALS["HTTP_RAW_POST_DATA"])){ $data = $GLOBALS["HTTP_RAW_POST_DATA"]; $myFileName = $_GET['ClientFile']; chmod($myFileName, 0777); $fp = fopen($myFileName,

[code].....

View 3 Replies

ActionScript 3.0 :: Writing An XML File?

Dec 1, 2010

I have successfully read an XML file into my script and used the data.Very handy.Now, I want to be able to create an XML file and save it.I have seen in the documentation how to add a child and so on - so I think I can manage that bit.I assume that I can save a file (locally) - but how? I have not been able to find a 'save'.

View 5 Replies

Actionscript 3 :: Writing To CSV File?

Sep 6, 2011

I have looked far and wide but I can't find any resources on how to write to CSV files from flash AS3. I know that flash cannot write to it alone. I have used PHP before to write to a txt file but now I need to open a csv and insert/edit entries that are already in it.

View 1 Replies

ActionScript 3.0 :: Use Variable When Writing XML?

Jul 28, 2009

I'm sure there's already an answer, but I haven't found it yet. (It may be because I'm not exactly sure how to phrase the question.) Here's the skeleton of what I've done.

Let's say that I'm making a simple guestbook. All I want is to collect the visitor's name and email address. I started out by creating a simple XML file that looks something like this[code]...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved