PDA

View Full Version : Can an app be created that uses a variable height/width?


youdontknowkhad
08-05-2009, 09:40 PM
I am not familiar with the order of operations for a flash file. I do believe the height and width are not declared in the actionscript, but I was wondering if there was a way to modify the height and width of a flash object on a page (on next load, possibly using a browser cookie) using actionscript contained within the flash object to be modified?

An example case would be a very simple applet that, when loaded, asks the user for a height and width. A user enters a value for one or both of these, then hits a save button [user input 300 x 400]. The next time the user loads the page which the flash object is on, the object's height and width are now defined by the values the user input earlier [flash file now loads at 300 x 400 size].

Is this possible? Is it feasible for someone with very limited actionscript experience?

BronL
08-06-2009, 07:22 AM
I think you would actually have to do this with javascript, as that is how the size of the object is controlled in the page. Along the lines of:

<pseudo>

1. Is there a cookie? (or a js variable from a form containing new size)

2. Generate a string containing the page source of your new html page, with either the cookie contents or some default value

3. Output the string to a new document.

</pseudo>

www.w3schools.com has a ton of examples, and this one

http://www.w3schools.com/js/tryit.asp?filename=try_dom_document_open

has some of the basics of what you want to do.

HTH

youdontknowkhad
08-06-2009, 08:32 AM
Thank you BronL, I did believe it was the case that the size of the object was written in to the code on the page. The workaround I was trying to achieve was to be able to upload a flash object to a flash portal but ultimately allow the user to select the object height. The flash portal in question has a module that appears alongside the user submitted flash object and scales in size to it's height. Ergo, to modify the height of the module, you would need to modify the height of the flash object. I hope to achieve this with only submitting a single flash file.

It looks like I might have a shot though, as I determined that the page in question examines the cookie BEFORE the swf file. Now I just have to figure out cookies... -_-

BronL
08-07-2009, 01:46 AM
That is certainly do-able (submit one flash file and resize). Again - I can't recommend www.w3schools.com highly enough. What I really like is on most pages they have a 'Try it' button that takes you to a page with sample code relevant to what you're reading about. There you can safely play with the code and see immediate results. And yes - they have a page on cookies. http://www.w3schools.com/JS/js_cookies.asp