Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 31st, 2002, 09:12 AM
esposito esposito is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 20 esposito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Saving data with the Windows Projector

First of all, a premise: I started to study Macromedia Flash MX a couple of weeks ago, so I'm a novice. I am interested not only in the creation of SWF Web applications but also in the possibility of developing executable files by means of the Windows Projector.

So far I have been programming my software using Microsoft Visual Basic but, having discovered the enormous graphic potential of Flash MX, I would very much like to exploit it for the production of Windows programs. Besides the graphic potential, I am attracted by the fact that, unlike Visual Basic, Flash EXE files don't need any runtime library to work.

I have been studying hard in order to explore the possibility of saving data with Flash and I have come to this quite disappointing conclusion: the only kind of data Flash can save locally is represented by cookies that you can manage using the
so-called "Shared Objects". Unfortunately, these cookies don't allow you to create databases of any kind and you will agree with me if I say professional programs very often need to store and retrieve data at a complex level.

As you know, dealing with data on the server side is not a problem, since Flash can interact with MySQL through PHP. So, the problem only regards EXEs.

I wonder if there is any way you could "force" Windows Projector files to save data on the hard disk. If I were able to save text files with Flash, I could try to organize them in such a way as to create a database playing with variables.

A friend of mine suggested I should try the MMSave method to save text files locally. To my surprise, I found out this method only works when you are operating in the design mode, i.e. when you have an open session of Flash. To experiment with that, you must do the following:

1. Launch Flash and place a button called btnSave on the stage in the first keyframe.

2. Insert the following script code in the keyframe Actions:

//*** START OF SCRIPT***
MMSave.getDirectory = function(){
var d = ASnative(302, 0)();
var i = d.lastIndexOf("/");
d = d.substr(0,i);
i = d.lastIndexOf("/")+1;
var chemin = new String(d.substr(0,i));
var barre;
for(i=0; i<chemin.length; i++) {
if (chemin.charAt(i)== "/") {
barre++;
};
};
barre -= 3;
var MyRoot = "";
for(i=1; i<=barre; i++) {
MyRoot += "..\\";
};
return MyRoot;
}
//***END OF SCRIPT***

The function above allows you to determine the root directory of the current drive, otherwise Flash will save the file in a default folder.

3. Insert the following code in the on_release event of btnSave:

//***START OF SCRIPT***
on (release) {
Mypath = MMSave.getDirectory();
MyPath = MyPath + "myflashfile.txt";
txtRecord.Text = MyPath
mystring="This is the text of the file I want to save locally.";
MMSave(mystring,MyPath);
}
//***END OF SCRIPT***

Now, if you run the SWF or EXE file while you are in the design mode, you'll be able to create a file called "myflashfile.txt" in the root folder (usually, C by pushing the button. Nevertheless, if you shut down Flash, run the SWF or the EXE and push the button, nothing will happen.

I believe the inability to save files locally is a consequence of the policy adopted by Macromedia aiming at preventing any malicious use of Flash. For example, a hacker could use this method in a loop statement which would fill up the whole hard disk.

For the same reason, Macromedia decided to limit the use of "fscommand exec", which now only allows to launch programs if they are located in a sub-folder called "fscommand".

Personally, I find this policy simply ridiculous. It is as if the American government decided to forbid the sale of breadknives because someone could use them to kill. What if I just want to slice a loaf of bread? I really hope in the future Macromedia can revise their policy, since I am convinced that with Flash you can create invincible software from the graphic point of view.

Anyway, I would like to ask you if you know any workaround method to save text files using a Flash MX (Windows Projector) EXE. The only way I have found so far is by embedding an SWF file within a Visual Basic application, but I would like to do it using Flash MX only, in order to create self-sufficient EXEs, i.e. executables which don't need any plug-in to run.

Thanks for your attention and allow me to wish you a happy new year.

Pasquale Esposito
Perugia (Italy)
http://web.tiscali.it/espositopasquale/

Reply With Quote
  #2  
Old January 27th, 2003, 02:01 PM
VAYKENT VAYKENT is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Provo
Posts: 36 VAYKENT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
This "...so-called "Shared Objects"..." is more powerfull than you think.

It allows you to store any Flash Object... ie XML.

AND it's stored in a binary format, which has been picked apart to some extent, so you could use it in other programs if you really had to.

I agree that MM should relax a little on the security, but Flash would not be what it is today if people were scared of installing it because someone had used it to spread a virus. I personally am waiting for a 'signed' plugin/addon that MM develops and maintains that will open up the client side of things a little more.

Other than the SO approach, you are free to use a DOS prompt... which should give you all the 'functionality' you need. You'll want to look into GetURL to run it.

Reply With Quote
  #3  
Old January 27th, 2003, 02:02 PM
VAYKENT VAYKENT is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Provo
Posts: 36 VAYKENT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
One more thing I forgot... Third party tools allow you to 'add' functionality... but it'd be the same thing as wrapping the Flash OCX in a VB EXE...

Check out http://www.northcode.com for SWFStudio if you want...

Reply With Quote
  #4  
Old January 29th, 2003, 04:04 AM
esposito esposito is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 20 esposito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face These absurd limitations...

Dear VAYKENT, thanks for your reply.

I don't agree with you when you say "Flash would not be what it is today if people were scared of installing it because someone had used it to spread a virus". I am referring to Windows Projector files only, not to SWF movies to publish on the Web.

What I mean is, these safety precautions make sense when talking about SWF files, since it is very easy to get viruses from the Internet (it's enough to visit the wrong site). On the contrary, I believe it doesn't make any sense to impose such limitations on the production of executable files, simply because reasonable users, before installing any software on their computers, make sure the source is reliable. So, these limitations do penalize honest programmers.

Can you imagine what would happen if Microsoft decided to prevent Visual Basic from saving data? I am sure all VB programmers would immediately switch to a different programming language.

Regarding the fact that, in your opinion, I underestimated Flash Shared Objects, as far as I know, they don't allow you to create a database. At least I was unable to use them to store more than one record. My goal is to develop a Windows Projector application containing two text boxes (txtName and txtEmail) and four buttons (btnAdd, btnRemove, btnPrevious and btnNext). The user should be able to fill in the text boxes, store or remove records and browse the database moving to the previous or next record. Do you think it is possible to develop this kind of (EXE) application with Flash MX?

In another discussion forum, somebody pointed out that Flash was made for the Web, not for the production of Windows applications. So, my question is, what's the point in allowing Flash programmers to create executables if all you can get out of them is splash screens or low-level games?

Thanks again and all the best.
__________
Pasquale Esposito
Perugia (Italy)
http://web.tiscali.it/espositopasquale/

Reply With Quote
  #5  
Old January 29th, 2003, 12:42 PM
VAYKENT VAYKENT is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Provo
Posts: 36 VAYKENT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Welll.. you're right.

To add to what you said... there are enough people already trying to bring Flash down becasue of some stupid 'security' issue... I'm glad MM doesn't give them any more reasons... but I constantly push for more functionality. I wish they would allow more functionality. Anyway...

About Shared Objects.

You can store any number of information in an SO... as well as any type of information.

If you can get your 'database' information into an XML format, then you can have your 'database'... it can work.

http://www.macromedia.com/support/f..._shared_object/

As for the application development - I've made full apps in just Flash.. but for extra functionality I usually had to open a socket to a local exe and ask it to do something...

p.s. - look at all the flak MS has gotten because of the viruses ~made~ in VB... and notice the MM's image hasn't gotten any of that flak

Reply With Quote
  #6  
Old February 11th, 2003, 10:25 AM
teabag teabag is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 8 teabag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Anyway, I would like to ask you if you know any workaround method to save text files using a Flash MX (Windows Projector) EXE. The only way I have found so far is by embedding an SWF file within a Visual Basic application, but I would like to do it using Flash MX only, in order to create self-sufficient EXEs, i.e. executables which don't need any plug-in to run.


Well that sounds hard. I don't know if you can do that without extra programs. I used Flawrite3.exe for this problem myself. it's available at:
http://www.flashtool.de/index3.php?lid=2

Licence: GNU / GPL
Price: 15.00 EUR
Comment: Free for non-commercial projects!

All the features are restricted to .js|.txt|.html|.htm|.sws|.xml and .css - files
Append blanks.
Append data to files.
Append linebreaks.
Copy files.
Create / overwrite files easily
Delete files

or to have even more functionality check out:
http://flashtools.net/downloads/fclt_downloads.htm
for several commandline tools that do this and more.

I know, it's not what you asked for, but it 's better than nuttin'


Tea.

Reply With Quote
  #7  
Old February 11th, 2003, 10:53 AM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
remember also, with shared objects, the user has the ability to control how much space they will allow (if any!) so this function will not always work...

bret

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Saving data with the Windows Projector


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway