Urgent Flash Action Script Help Needed please!

  • Show69
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: South Africa

Post 3+ Months Ago

Hi everyone :)

I have a little problem in Flash MX i'm have 2 Radio Buttons and 1 normal Button called submit.

Well The problem is i ain't that good in Action Script at all and i need to make these buttons work as follow:

Radio button is called Install SQL and Second is called Install SQL Express. Well it must work as if you select Radio button one ( meaning Install SQL ) and you click on submit that the submit button will install SQL and if you click on Radio Button 2 the and then submit it will install SQL Express.

The thing is i don't know how the submit button is gonna know what is selected and then knows what to install.

Please if anyone can help i would appreciate it so much thanks
  • montyt
  • Proficient
  • Proficient
  • User avatar
  • Posts: 275

Post 3+ Months Ago

r u asking for help or posting a new flash project
  • Show69
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: South Africa

Post 3+ Months Ago

Asking for Help
  • Show69
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: South Africa

Post 3+ Months Ago

To everyone reading this " Is this i'm asking possible or not? " Seeing that no one know how to do this.

For i have been trying for almost 2 weeks to figure this out and can't figure out how so if anyone can be of help it will be appreciate thanx!
  • montyt
  • Proficient
  • Proficient
  • User avatar
  • Posts: 275

Post 3+ Months Ago

wat code u have used post here.
  • Show69
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: South Africa

Post 3+ Months Ago

Well i tried variations of mostly using "if" and variable's and even tried using code for movies and can't seem to find the right method.
  • Belk Media Group
  • Graphic Monk
  • Professor
  • User avatar
  • Posts: 777
  • Loc: In the heart of California, Fresno.

Post 3+ Months Ago

Hmmm, I am not aware that Flash can install anything. It can open a connection to a database but not so sure about installing.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

@origin: you can install from the projector using fscommand("execute", "path_to_execute");
@Show69:
As for the radio buttons, i don't really see the meaning of the question.
if (radio1.checked) => path_to_execute = "installSQL.bat"
else if (radio2.checked) => path_to_execute ="installSQLExpress.bat"
Of course, this means you read a little help and eventually google search for using radio boxes in flash, that's all you got to do. But probably you lack the programming part for good, cos if you say in 2 weeks you couldn't do an if / else, then this really raise many question marks about your programming skills.
  • Belk Media Group
  • Graphic Monk
  • Professor
  • User avatar
  • Posts: 777
  • Loc: In the heart of California, Fresno.

Post 3+ Months Ago

Well, looky there. Learn something new everyday. Thanks IceCold I am going to have to explore this new information.
  • montyt
  • Proficient
  • Proficient
  • User avatar
  • Posts: 275

Post 3+ Months Ago

here is the solution
Code: [ Select ]
this.onEnterFrame = function() {
    sumbit.onRelease = function() {
        if (btn1.selected == true) {
            fscommand("exec", "file.bat");
        }
        if (btn2.selected == true) {
            fscommand("exec", "file2.bat");
        }
    };
};
  1. this.onEnterFrame = function() {
  2.     sumbit.onRelease = function() {
  3.         if (btn1.selected == true) {
  4.             fscommand("exec", "file.bat");
  5.         }
  6.         if (btn2.selected == true) {
  7.             fscommand("exec", "file2.bat");
  8.         }
  9.     };
  10. };

than create one folder named "fscommand". Inside that keep two ".bat" files. Edit that bat file in "dos" and rite this line. Keep ur ".exe" file along with that ".bat" file. inside that fscommand folder.
Code: [ Select ]
start xyz.exe

The function u r looking, that is not going to work from a ".swf". U need to Export that to ".exe", "flash projector".

than these things gone work.
cheer
  • Show69
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: South Africa

Post 3+ Months Ago

Thanx everyone and thanks again montyt you always there to help me a bit.

And IceCold well i told in the beginning that my coding in flash sucks i am more on the Designing side so sorry if i just want to learn more about flash scripting and C# and whatever.

But thanx anyway for all your help everyone maybe someday if you need any graphics i can be helpful to you all again thanx

I tried this and added a listner object and this was the code it didn't want to work don't know why!?!?

var listenerObject:Object = new Object();
listenerObject.click = function(eventObj:Object) {
};

radioButtonGroup.addEventListener("click", listenerObject);

submit_btn.onRelease = function(){
if(rb0.value == true){
// code to install
}
if(rb1.value == true){
// code to install
}
}
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

it's not about coding in flash or coding in c# or coding in whatever. It's all about logic.
Now, i'm gonna give you a very easy example which does not require any UI component.
1. start a new flash document, 1 fram, 3 layers
2. layer 1: make a new movieclip and name it radioBox; in first frame draw something like an unchecked radio box ( lets's say just a circle), and in the second frame, make another layer and inside it place a black filled circle, so it will look like a checked radio box
3. add a new layer and in the first key frame and add this code:
Code: [ Select ]
var bChecked:Boolean=false;
this.onRelease = function() {
if (bChecked)
{
  this.gotoAndStop(1);
  bChecked = false;
}
else
{
 this.gotoAndStop(2);
 bChecked = true;
}
stop();
  1. var bChecked:Boolean=false;
  2. this.onRelease = function() {
  3. if (bChecked)
  4. {
  5.   this.gotoAndStop(1);
  6.   bChecked = false;
  7. }
  8. else
  9. {
  10.  this.gotoAndStop(2);
  11.  bChecked = true;
  12. }
  13. stop();

in second key frame:
Code: [ Select ]
stop();

4. go to main timeline, give the radioBox an instance name, name it rBox1;
5. layer2: place a button on the stage, instance name it btnSubmit
6. layer3: in main timeline,
in keyframe (not on a movie clip just in the key frame) add this code:
Code: [ Select ]
btnSubmit.onRelease = function()
{
  if (rBox1.bChecked)
   trace("is checked");
 else
  trace ("is not checked");
}
  1. btnSubmit.onRelease = function()
  2. {
  3.   if (rBox1.bChecked)
  4.    trace("is checked");
  5.  else
  6.   trace ("is not checked");
  7. }


Try this first and tell me if it works for you.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

@montyt: i have a question for you
do you really know what onEnterFrame is doing?
and what sumbit.onRelease is doing?

if you do, then why on earth do you use onEnterFrame when onRelease is triggered exactly when the button is released.
  • montyt
  • Proficient
  • Proficient
  • User avatar
  • Posts: 275

Post 3+ Months Ago

IceCold wrote:
@montyt: i have a question for you
do you really know what onEnterFrame is doing?
and what sumbit.onRelease is doing?

if you do, then why on earth do you use onEnterFrame when onRelease is triggered exactly when the button is released.


can u please tell me what u want to prove
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

if your movie is set to 21 fps the onEnterFrame event will execute 21 times ...
meaning if you have functions invoked under the onEnterFrame they will execute 21 times per/s which can cause the movie going slow and consume alot of the memory resources depending on the functions invoked ...

you dont need onEnterFrame to write a code for a button or a movieclip ...

you can just : my_btn.onRelease = function ....
  • Show69
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: South Africa

Post 3+ Months Ago

Well people i found my own solution and it works just fine thanx for all your help at the end i just used the following:

on (click)
{
if (_level0.Radio1.selected) {
getURL("Setup.exe");
} else {
getURL("Setup2.exe");
}
}

And bang it works just gr8!
  • Show69
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: South Africa

Post 3+ Months Ago

IceCold sorry if i am not up to your coding standards i just asked for help cause i'm new at this line of work doing coding in actionscript its a gr8 difference in HTML and so on and why i said C# well if you know C# then actionscript and java is not so hard cause a person has a basic understanding then of the coding. SO as i said thanks for your help and sorry if my logic into coding is not that good well tuff *plum* i'm a designer just trying new things!

Take care
  • montyt
  • Proficient
  • Proficient
  • User avatar
  • Posts: 275

Post 3+ Months Ago

gr8

no matter what code u use. Ultimately ur output is to get ur work done. If that code works for u than fine. that's all.

if ur client is happy u r happy.

cheers
  • Show69
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: South Africa

Post 3+ Months Ago

Again thanx and that is right man at the end if it works it works no matter how you did it as long as you know how you did it and understand it then all is just great thanx MONTYT
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

Show69, is not about my coding standards, is about basic understanding of coding. And coding is usually very logic. U set a goal and then you try to find the meanings to reach that goal. For me 2 weeks is way to much for 5 lines of basic code which with the minimum of effort you can find either in flash help or in online tutorial, without knowing anything about actionscript.
But then again, that's just me; probably programming requires some other kind of logic, who knows. For example, i tried to teach my girlfriend some basic coding stuff, man it was hard. She was like a monkey, repeating everything she learned, but didn't use her thinking at all, even though i always repeat her to think first. So if i changed a bit the pattern, baaang, she got stucked.

Coding is pretty much like drawing. You think what you want to draw, you start drawing, link your drawings so that will be a whole, enhance something, adjust something else, until u get the drawing done.
I must confess, i'm not talented at graphics, it's hard for me to focus and visualize the big picture, so i usually inspire from other drawings. And doing that, i developed a decent eye for graphics. On the other hand, when it's about programming, then i can visualize the final application and then think it to the last detail. I guess it's about the way our brains are wired, but still we can learn new things even if we don't have the gift for that.

I guess you know now why i was a bit too rough with you.

@montyt: don't get upset, just ... read :D
Quote:
But having a nested function costs. For each nested function, the outer function has to create an activation object which has some performance and memory impact.
Now what are these memory impacts? Whenever a function is executed a activation object is created for the call. In lay man terms it is actually pushing all the arguments, the return address on the stack. Thus an activation object stores all these things along with all the local variable declarations. Along with this a scope chain is also created that contains an ordered list of objects that Flash Player checks for identifier declarations. Thus each function has a scope chain property (internal property) associated with it. The scope chain goes up until it reaches the global object.

Coming back to nested functions, in case of such declarations not only there is an overhead of an extra storage for activation object, the increase in length of the scope chain increases the scope of the function and thus player’s job of scope-resolution increases which hurts performance.

Thus, next time your code execution can become really slow if you just don’t bother!!!

Post Information

  • Total Posts in this topic: 20 posts
  • Users browsing this forum: No registered users and 6 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.