FlashLite ActionScript
Hi,i hope anyone can help me. I have already develop some application using Flash 8 but using a flashlite actionscript. i have a problem to use a certain part of key in mobile phone. Fisrtly, i create a coding for using a familiar key (arrow) but how can i do to move to home and exit button.here i my link to get a source fla file. hope can help me.one more, is a next and prvious button.TQhttp://ftmk.kutkm.edu.my/ibrahim/psm.fla
Adobe > ActionScript 1 and 2
Posted on: 01/19/2007 12:04:45 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
FlashLite ActionScript
Hi,
i hope anyone can help me. I have already develop some application using Flash 8 but using a flashlite actionscript. i have a problem to use a certain part of key in mobile phone. Fisrtly, i create a coding for using a familiar key (arrow) but how can i do to move to home and exit button.
here i my link to get a source fla file. hope can help me.
one more, is a next and prvious button.
TQ
http://ftmk.kutkm.edu.my/ibrahim/ps.fla
FlashLite ActionScript
Hi,
i hope someone can help me to solve this problem. I have already to develop an application usiang Flash 8 but the coding is using FlashLite ActionScript. I have no idea to use some key in mobile phone function. i have already using a familiar keys in upside in mobile phone, can we use that key to move another button have i create. e.g - a home and quit button. one me is how can we create some coding to go next and previous button.
This link, you can see the fla file tu and know a problem is.
TQ
http://ftmk.kutkm.edu.my/ibrahim/psm.fla
API's Of Flashlite
Hi Guys,
I am chethan, I need a help on which my whole project stands.
I need to know all the API's available in flashlite.
Please please please let me know.
Thanks & Regards,
Chethan
Developing For Flashlite 2
Hello,
I've been asked to develop an application in FlashLite 2 to run on a phone. Is this just like developing for other Flash apps, except that you create at the phones screensize and export to FlashLite 2, more or less, or is the entire process much different? Any tips anyone can give me will be most appreciated!
Thanks!
Makefile For Flashlite
Hi Experts,
Generally a project is organized by Makefile. But for flash, I can not fine command line for publish. So I do not know how to intergrate flash content into makefile without opening flash authoring tool. Anyone has the solution for this?
Thanks.
A Rookie,
Combobox In FlashLite 2.1
Is it possible to use a combobox inFlash Lite 2.1?
It's only working when I use a Flash 6 File on the PDA but not a FL2.1 file?
thx KH
Combobox In FlashLite 2.1
Is it possible to use a combobox inFlash Lite 2.1?
It's only working when I use a Flash 6 File on the PDA but not a FL2.1 file?
thx KH
FlashLite Doubt...
Hi there...
i saw in the Device Central that just certain amount of Nokias can run my swf application.
How can i make the "other nokias" run it too?
Thanks.
Cheers.
Leo
FlashLite/player For A Wristwatch ?
Has anyone ever come across an LCD wristwatch that will run any version of the flash player. Is anyone developing such a thing?
Would it need to run Windows mobil or linux or what?
My aim, from a software POV, is to produce customised flash time pieces. At present there are several mobile devices that will run such things but none of them that could be worn on the wrist on a day to day basis.
Work in progress MINORITY REPORT example here
Come on technology companies. This should've been acomplished well before now! What are you playing at!
Ptol
Developing In Flashlite Without Adobe IDE
Here I am, another newbie for you, with another, stupid (for you....) question:
how do I start programming in Flash?
1) I have a Motorola A1000 cellphone. I think it supports Flashlite 1.1; so, first question: how can I be SURE about which version it supports, being its standard documentation not affordable?
Phone starts this SWF, but the only item containing a result is Player Version (EPOC 5,0,96): what does it mean? Why are other fields empty?
Same SWF behaves same way on Opera on PC, but Player Version appears to be WIN 9,0,16,0 .
2) I don't want to by Adobe IDE to write my program, as I know several opensource/freeware solutions exist, based on MTASC compiler: FAME environment ( http://www.communitymx.com/content/a...ge=1&cid=F3ECF ) and FlashDevelop ( http://www.flashdevelop.org/communit...topic.php?t=23 ), maybe others; for the first one, I can't understand how to solve point 4 in page 2: where do I find "intrinsic classes" if I do not have Adobe IDE installed? Do I really need them?
3) Last question: once I'm able to get my source compiled, where do I start from studying ActionScript? All tutorial I find suppose I already know Flash, as they talks about "frames" (????) and suddenly use statements I never heard before and I don't know where to search for. Does it exist a real "Actionscript getting started tutorial" for total Flash newbies?
Thanks for you patience....
Flashlite Script Issues
I'm having a hard time with loading my text from subzone.
Code:
//Script To Generate Default Information and names about each subzone
//When you want to put information in get rid of code after this and use:
//Where it is zone 1, subzone 2.
///:name1-2 = "Snack Bar" - To Define The Name Of Each Subzome
///:info1-2 = "Dance Hall" - To Define The Information In Each Subzone
///:type1-2 = 1- To Define The Type Of Structure It Is, Should be a Number realting to the types defined above.
for (i=1; i<=/:zones; i++) {
for (k=1; k<=eval("/:zone" add i add "sub"); k++) {
set("/:name" add i add "o" add k, "Zone " add i add "-" add k);
set("/:info" add i add "o" add k, "Here will be information about zone " add i add "-" add k add ". This subzone is a very nice place to visit both during the day and the night. It has a large number of interesting activitys for all the family.");
//Random Type Of Property Each Place Is
type = random(3)+1;
set("/:type" add i add "o" add k, type);
}
}
/:name1o2 = "Snack Bar 1";
/:info1o2 = "Light meals are served.<br>Price Range: $2 thru $3<br>Cuisine: American<br>Meals: Snack<br>Service Type:*Fast Food Counter / Snack<br><br>Menu<br>-----------------<br> Coke or Root Beet Float - $2.99<br> Apple Slices - $1.49<br><br>Beverages<br>-----------------<br> Apple Juice - $1.49<br> Hot Cocoa - $1.59<br> Coffee - $1.59<br> Bottled Water - $2.50<br> Coke, Diet Coke, Sprite, Root Beer, or Minute Maid<br>Lemonade - $1.99, $2.29";
/:type1o2 = 1;
// Where it is zone 2, subzone 2.
/:name2o2 = "Dance Hall";
/:info1o2 = "Dance to the tunes of pop, rock and blues";
/:type2o2 = 2;
}
XMLsocket + Localhost + FlashLite 2.1
Hi,
On FlashLite2.1, trivial XMLSocket code connecting to a localhost
server fails in a strange manner:
- The server sees the connection as established
- But the onConnect callback never gets called
This happens only on the device (a WM5 Samsung i860 smartphone). Not
in Device Central.
This does not happen if the server is more "remote" (over USB or
GPRS).
I suspect an issue with the speed of establishment of the socket, a
kind of race condition in the implementation of XMLsocket.connect().
The code, in the Actions of a single frame swf, is:
var sok:XMLSocket;
// do_connect is bound to a button press event
function do_connect()
{
sok=new XMLSocket();
sok.onConnect=function(){ /* set some dynamic text
variable */}
if (sok.connect("127.0.0.1",4444)) { /* do some other
visible effect */}
}
In the emulator it works like a charm. On the device, sok.connect()
return true but the visible effect of onConnect (setting some dynamic
text in the frame) never occurs !
Any idea ?
-Alex
Can We Give LED Effect In Flashlite...?
Hi,
Can you please anyone just tell me is it possible to give LED effect in flashlite for mobile device.
If yes, please please let me know how to do coding for that..
thanks in advance for your efforts..
Chethan.
FlashLite 2.0 Motion+Physics Capabilities
Hello.
My name is Mr Ogilvie, I work for a small Japanese mobile phone game development company.
My question is only related to Flash Lite, therefore I hope this is an appropriate place to post this new thread.
We would like to create a pinball game for use on a cell phone capable of using FL 2.0.
We have tested various methods for creating such a game but unfortunately having many issues with the amount of mathematics involved or amount of loops needed to be run.
The issue lies most likely with the processing power of the cell phones, though this cannot be helped. [We test on a broad range of phones from KDDI, SOFTBANK, TOSHIBA, ect.ect.]
We have tried using and completed making games with these methods;
-Vector physics game engine - drawing lines and using vector calculations to find the approach angle and calculate the exact bounce from the normal to the line.
[Uses a for loop and too much math and worst of all this method is frame dependant]
-Tile based game engine - well... uses tiles... [frame independent]
[All was going well until we needed to integrate the flippers which we could not do because there was no way to get an accurate action form the flippers as the ball was being drawn from runtime, not a movieclip like the flippers.
-Hittests - creating a movieclip of every boundary line in the game and performing hittests upon them with the ball.
Hittests will work but the ball physics is aweful and again the frame rate is poor so the ball can easily be a long way past the line movieclip before a hittest is recognised [Due to the fact that, again, this method is frame dependant].
They all work tremendously well using flash player on PC.
The main cause seems to be when switching to Mobile platform; the frame rate is too low to complete the amount of calculations per frame.
We searched many resources including the many endless pages on the internet.
Could bright sparks from Adobe shed some secrets on best methods to script FL 2.0 motion games. Most specifically, pinball. That would be much appreciated.
Best Regards,
Mr Ogilvie
TOKYO ANAGRAM Co.,Ltd. ---------------------
#202, 3-5-14
Iwamoto-cho, Chiyoda-ku, Tokyo
Japan, #101-0032
Phone : +81-3-5823-6165
FAX : +81-3-5823-6166
http://anagram.jp/
Alex Ogilvie [ Co Web Producer ]
+81-70-5070-1849
alex@anagram.jp
--------------------------------- Our Web Services
GAME FRONTIER
http://www.game-frontier.com/
TUNEGRAM
http://tunegram.jp/
SimpleRPG
http://www.simplerpg.com/
Flashlite Loading Text Issues
I'm having a hard time with loading my text from subzone.
Code:
//Script To Generate Default Information and names about each subzone
//When you want to put information in get rid of code after this and use:
//Where it is zone 1, subzone 2.
///:name1-2 = "Snack Bar" - To Define The Name Of Each Subzome
///:info1-2 = "Dance Hall" - To Define The Information In Each Subzone
///:type1-2 = 1- To Define The Type Of Structure It Is, Should be a Number realting to the types defined above.
for (i=1; i<=/:zones; i++) {
for (k=1; k<=eval("/:zone" add i add "sub"); k++) {
set("/:name" add i add "o" add k, "Zone " add i add "-" add k);
set("/:info" add i add "o" add k, "Here will be information about zone " add i add "-" add k add ". This subzone is a very nice place to visit both during the day and the night. It has a large number of interesting activitys for all the family.");
//Random Type Of Property Each Place Is
type = random(3)+1;
set("/:type" add i add "o" add k, type);
}
}
/:name1o2 = "Snack Bar 1";
/:info1o2 = "Light meals are served.<br>Price Range: $2 thru $3<br>Cuisine: American<br>Meals: Snack<br>Service Type:*Fast Food Counter / Snack<br><br>Menu<br>-----------------<br> Coke or Root Beet Float - $2.99<br> Apple Slices - $1.49<br><br>Beverages<br>-----------------<br> Apple Juice - $1.49<br> Hot Cocoa - $1.59<br> Coffee - $1.59<br> Bottled Water - $2.50<br> Coke, Diet Coke, Sprite, Root Beer, or Minute Maid<br>Lemonade - $1.99, $2.29";
/:type1o2 = 1;
// Where it is zone 2, subzone 2.
/:name2o2 = "Dance Hall";
/:info1o2 = "Dance to the tunes of pop, rock and blues";
/:type2o2 = 2;
}
How To Disable The Flashlite Popup Menu
i am a flash mobile developer is there anyway to disable the flash popup menu (when i press for more then 2 secounds on the screen (you know like the right click on the pc).
So please plase let me know if anyone knows about this.
Thanks a lot lot lot in advance.
Chethan
Interview Questions Pattern For Flashlite 2.0
Hello Guys!!!
Acatully I have to face an interview on flashlite. I am not at all getting how get prepare on that. Can anyone give guidlines, questions pattern, interview questions for that.
Please help me... I need it hardly....Actaully I searched in net.. but I didn't get anything.
If anyone having frequently asked questions for flashlite.. please let me know....
Plz plz plz.. help me anyone..
Thanks for your efforts -
Thanks and Regards,
Chethan.
Flashlite 2.1- Action Script For Camera
Hello All of you,
Please let me know anyone, whether Flashlite 2.1 supports for camera functionality or not...!!!
If it supports please please let me know how to do it. Atleast give some clue....
Thanks and Regards
Chethan
Flash Player Development For Flashlite
Hello
I watched Lee's VIDEO BASICS series for making an FLV player. I really liked it. i myself is nt a designer but working on a project which is flash based for mobiles. I have fewnquestions:
1)Can I use NetConnection and netStram classes on Flashlite?
2)What methods could be used to play,stop and seek for Flashlite based video
P.s: I don't know how Lee enabled the intellisense for NetConnection or other classes when he wrote "var nc:" it shows mentionec classes in drop down.
How do I do that?
Thanks
[FCS3] Adding Actionscript To A Movieclip Through Actionscript?
Yo, is there a way to add actionscript to a movieclip created in actionscript? Such as a onClipEvent(load) and onClipEvent(enterframe)? I have a onEnterFrame already for the movie clip as its created though. I have taken code thats from a gravity tutorial where it uses the two methods above. I've tried adding them into the onEnterFrame that I had already to add gravity to the movieclips created though that did'nt work =(
Jigsaw Puzzle - Changing From Actionscript 2.0 To Actionscript 3.0
Hello Everyone,
I was hoping someone could help me convert the following actionscript from actionscript 2.0 to actionscript 3.0. I'm trying to complete a jigsaw puzzple but I'm having problems converting it into actionscript 3.0.
Below is my actionscript:
//Puzzle Pieces
scramble_btn.onRelease = function(){
piece1._x = random(250);
piece1._y= random(250);
piece2._x = random(250);
piece2._y= random(250);
piece3._x = random(250);
piece3._y= random(250);
piece4._x = random(250);
piece4._y= random(250);
startGame();
messageOn.text = "";
counter.text = "00:00";
clearInterval(timeStarted);
timeStarted = setInterval(countdown, 1000);
time_start = 0;
}
//Puzzle Move
function startGame(){
piece1.onPress = function(){
this.startDrag();
piece1.swapDepths(1)
}
piece1.onRelease = function() {
this.stopDrag();
hit1();
checker();
};
piece2.onPress = function(){
this.startDrag();
piece2.swapDepths(1)
}
piece2.onRelease = function() {
this.stopDrag();
hit2();
checker();
};
piece3.onPress = function(){
this.startDrag();
piece3.swapDepths(1)
}
piece3.onRelease = function() {
this.stopDrag();
hit3();
checker();
};
piece4.onPress = function(){
this.startDrag();
piece4.swapDepths(1)
}
piece4.onRelease = function() {
this.stopDrag();
hit4();
checker();
}
};
//HitTest Script
function hit1(){
if(piece1.hitTest(container1)){
piece1._x = container1._x;
piece1._y = container1._y;
}else{
piece1._x = random(250);
piece1._y = random(250);
}
}
function hit2(){
if(piece2.hitTest(container2)){
piece2._x = container2._x;
piece2._y = container2._y;
}else{
piece2._x = random(250);
piece2._y = random(250);
}
}
function hit3(){
if(piece3.hitTest(container3)){
piece3._x = container3._x;
piece3._y = container3._y;
}else{
piece3._x = random(250);
piece3._y = random(250);
}
}
function hit4(){
if(piece4.hitTest(container4)){
piece4._x = container4._x;
piece4._y = container4._y;
}else{
piece4._x = random(250);
piece4._y = random(250);
}
}
//Timer
counter.text = "00:00";
function countdown() {
started();
time_start = time_start+1;
if (time_start>10) {
messageOn.text = "GAME OVER!!!";
clearInterval(timeStarted);
}
}
function started(){
sec = Math.floor(time_start+1/1000);
sec = (sec<10)?"0"+sec:sec;
min = Math.floor(sec/60);
min = (min<10)?"0"+min:min;
counter.text = min+":"+sec;
};
//This will check if all puzzle pieces are complete...and display game finish messsage.
function checker(){
if((piece1.hitTest(container1)) && (piece2.hitTest(container2)) && (piece3.hitTest(container3)) && (piece4.hitTest(container4))){
messageOn.text = "CONGRATULATIONS!!!";
clearInterval(timeStarted);
}
}
Giving Actionscript To An Actionscript-loaded Movie
How can I (if possible) set actionscript (say, an on-mouse event) to a movie that I load via attachMovie()? I poked around and I couldn't seem to find an answer...
I want the movie that I load via attachMovie() to have an on(RollOver) event...any thoughts?
Warning: An ActionScript 1.0/2.0 SWF File Has Loaded An ActionScript 3.0 SWF;
Hi all,
I'm trying to clone an swf (produced in CS3) that has been loaded into my app (built using Actionscript/mxmlc) but keep getting the following message appear in my logs:
Code:
Warning: An ActionScript 1.0/2.0 SWF file has loaded an ActionScript 3.0 SWF; code in the ActionScript 3.0 SWF will not run.
I know the CS3 swf has been produced using Actionscript 3 as it's settings and published for FP9. It does nothing more than a motion tween of a graphic.
Here is a really simple example of how to emulate the problem:
ActionScript Code:
package{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
[SWF(backgroundColor=0x000000)]
public class Test extends Sprite{
private var _mc:MovieClip;
public function Test():void{
var mc:String = "rain.swf";
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loadedSWF);
ldr.load(new URLRequest(mc));
}
private function loadedSWF(e:Event):void{
var mc:MovieClip = MovieClip(e.target.content);
this._mc = MovieClip(new (mc.constructor)());
this.addChild(this._mc);
}
}
}
I'm using the following version of mxmlc: Version 3.0.0 build 1844
I've also tried a slightly more convoluted way:
ActionScript Code:
package{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.getQualifiedClassName;
import flash.net.URLRequest;
[SWF(backgroundColor=0x000000)]
public class Test extends Sprite{
private var _mc:MovieClip;
public function Test():void{
var mc:String = "rain.swf";
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loadedSWF);
ldr.load(new URLRequest(mc));
}
private function loadedSWF(e:Event):void{
var c:Class = Class(e.target.applicationDomain.getDefinition(getQualifiedClassName(e.target.content)));
this._mc = new c();
this.addChild(this._mc);
}
}
}
I would like to know what's causing the warning message, am I doing something wrong?
Actionscript - User Input Actionscript
I am trying to develop a way where by a users input can determine the number of fields in a form e.g. the user inputs the number 3 then the form would have 3 fields
can you show me or point me in the direction of an example i can look at and manipulate?
[F8] Flash6 Actionscript 2, Flash 8 Actionscript 2...help
Ok loosing it a bit now, have gone back to a very old project from a Flash 6 file, managed to convert the script language to ActionScript2, works fine as flash6 actionscript2, but once I change the project to be flash 8 I get One error......and I know where it's coming from (see below), Have come to a dead - end here, so hope that one of you guys may be able to help me....
Feel free to use this if you can get it working, just credit the designer (Me).
On the main stage MC named "site", go inside and double click on any of the MC's (named "str0, or str1 etc....all instances). Once inside an "str" MC move to frame 2 and the MC on the stage should be called "seg0 or seg1 etc...(again all instances"), go inside the MC and click on frame 1 of the actions layer. Scroll down and look for the variable named "var nummer = _parent.plus+Number(this._name.substr(3, 1));"....this always returns NaN in flash player 8, but works in flash player 6?.................help me.....I'm drowning.
link to files:
http://www.solidvision.co.uk/dev/help.zip
Moving A Game From Actionscript 1.0 To Actionscript 2.0...
Hi there.
I hope someone can help me out here. I have been asked to create a simple Flash memory game, and I have been given a template to use as a basis. However, this template has been created in Actionscript 1.0 for Flash player 5. I now need to transfer it over to Actionscript 2.0 Flash player 8, and Ive noticed lots of odd behaviour once it has been changed.
Here is the code....
Code:
initGame();
stop();
function initGame() {
// make sorted list of cards
cardsListOrdered = [];
for (i=1; i<=18; i++) {
cardsListOrdered.push(i, i);
}
// shuffle list
cardsListSorted = [];
while (cardsListOrdered.length>0) {
r = int(Math.random()*cardsListOrdered.length);
cardsListSorted.push(cardsListOrdered[r]);
cardsListOrdered.splice(r, 1);
}
// create card clips and assign their location and picture
x = 0;
y = 0;
for (i=0; i<36; i++) {
attachMovie("Card", "Card"+i, i);
_root["Card"+i].picture = cardsListSorted[i];
_root["Card"+i]._x = x*60+200;
_root["Card"+i]._y = y*60+50;
// move to next card spot
x++;
if (x>5) {
x = 0;
y++;
}
}
firstclip = 0;
}
function clickCard(clip) {
// see if two card are showing
if (secondclip != 0) {
// turn those two cards back over
firstclip.enabled = true;
secondclip.enabled = true;
firstclip.gotoAndStop(1);
secondclip.gotoAndStop(1);
firstclip = 0;
secondclip = 0;
}
// see if same card was clicked
if (firstclip == clip) {
// turn card back over
firstclip.gotoAndStop(1);
firstclip = 0;
// see if no cards are showing
} else if (firstclip == 0) {
// turn first card over
clip.gotoAndStop(clip.picture+1);
firstclip = clip;
firstclip.enabled = false;
// must be one card showing
} else {
// turn second card over
clip.gotoAndStop(clip.picture+1);
secondclip = clip;
secondclip.enabled = false;
// see if two cards match
if (firstclip.picture == secondclip.picture) {
// Disable both cards
firstclip.enabled = false;
secondclip.enabled = false;
firstclip = 0;
secondclip = 0;
}
}
}
When set to FlashPlayer5, all works well. If a player tries clicking the same tile twice, it stops them. Also, when a pair of tiles are uncovered, again, the user is no-longer able to press them. This was done using the "enabled = false".
However, when I change it to Flash Player 8, none of these seems to work. Ill include the .fla so someone could possibly play around with it and see where the problem is, or whether there is another way to do it....
Hope someone can help.
Many thanks
Swf Actionscript 3, Load A Actionscript 2 File.
Hey dudes.
I need some help over here:
i have one banner player, and load some external swf files in actionscript 2, but the player is actionscript 3.
The files is loaded like a movie, when load a as2 files into as3. I just need a trigger when the swf file ends, when is in the last frame of movie.
Someone have a ideia in how do that?
thanks!
Flash ActionScript == Flex ActionScript?
Is ActionScript basically programmed the same way for Flash as it is for Flex? I know some folks who develop in AS for Flex. I didn't know if it was exactly the same for Flash, so I could tap them as a resource when I have an AS question.
Thanks,
Loren
Urgent :Getting Actionscript To 'pause' - Actionscript 2.0
Hi guys,
I need the actionscript to carry out a piece of code, then pause for 0.5 seconds, then carry out the next piece of code, then pause, then next code e.t.c
There will be twenty pieces of code that build up an animation with tweens that need to start at different times.
I guess its something to do with setInterval, but I'm not sure on the syntax, as there 20 pieces of code I don't want lots of nested code (though if thats the only way to do it then so be it!)
I'd really appreciate your help guys
cheers
Obtaining An ActionScript 2 Variable From ActionScript 3
Probably one of the most subjects on this forum has to be ActionScript 3 and ActionScript 2 communication. I found several threads on how to communicate between the two using a LocalConnection class, but there is one problem with this approach - I can't transport any values with it. Because LocationConnection.send doesn't have a return type, there is no way to transport a value from AS2 to AS3. This is very unfortunate, as I need to have access to a value that is set somewhere in the AS2 code.
I could use JavaScript as a middle layer to communicate the data between the two, but this will be a very ineffective way to achieve it. Are there any better ways for doing this?
ActionScript 3.0 Is 5~7 Times Slower Then ActionScript 2.0
I have a code that will translate this XML
quote:
<?xml version='1.0'?>
<Member>
<M>
<Username>Test 1</Username>
<Password>Test 1 Password</Password>
</M>
<M>
<Username>Test 2</Username>
<Password>Test 2 Password</Password>
</M>
<M>
<Username>Test 3</Username>
<Password>Test 3 Password</Password>
</M>
</Member>
Into this array
quote:
Array[0].Username = "Test 1"
Array[0].Password = "Test 1 Password"
Array[1].Username = "Test 2"
Array[1].Password = "Test 2 Password"
Array[2].Username = "Test 3"
Array[2].Password = "Test 3 Password"
Here is my variable declaration
quote:
var StartTime:Number = getTimer();
var EndTime:Number = getTimer();
var j:Number = 0;//This Variables used for ActionScript 3.0 Loop
var k:Number = 0;//This Variables used for ActionScript 3.0 Loop
Here is the XML String
quote:
var MyXMLString:String = "<?xml version='1.0'?><member><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O></member>";
var MyXML:XML = new XML(MyXMLString);//Parse the XML ONCE
I have a function called ConvertXML , and to check the performance i made it loop every frame by calling the following RunXML function
quote:
function RunXML(Events:Event){
StartTime = getTimer();
for(var i:Number=0;i<100;i++){
var MyXMLArr:Array = ConvertXML(MyXML, false, false);
}
EndTime = getTimer();
trace(EndTime - StartTime + " ms");
}
and here is my code for parsing the variable MyXML in ActionScript 3.0 (ConvertXML function)
quote:
//Action Script 3.0 ConvertXML
import flash.xml.*;
function ConvertXML(RecvXML:XML, ChildBranch:Boolean, IsTable:Boolean):Array {
var RowArr:Array = new Array();
for (j=0; j<RecvXML.child("*").length(); j++) {
var TempObject = new Object();
for (k=0; k<RecvXML.child("*")[j].elements("*").length(); k++) {
TempObject[RecvXML.child("*")[j].elements("*")[k].name()] = RecvXML.child("*")[j].elements("*")[k];
}
RowArr.push(TempObject);
}
return RowArr;
}
addEventListener(Event.ENTER_FRAME, RunXML);
The code above run 5~7 times slower then the following actionscript 2.0 code
quote:
//Action Script 2.0 ConvertXML
function ConvertXML(RecvXML:XML, ChildBranch:Boolean, IsTable:Boolean):Array {
var RowArr:Array = new Array();
for (var aNode:XMLNode = RecvXML.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
var TempRecord:Object = new Object();
for (var bNode:XMLNode = aNode.firstChild; bNode != null; bNode=bNode.nextSibling) {
TempRecord[bNode.nodeName] = bNode.firstChild.toString();
}
RowArr.push(TempRecord);
}
return RowArr;
}
this.onEnterFrame = RunXML;
they both does exactly the same thing.. and yet the actionscript 3.0 code run 5~7 TIMES SLOWER . why?
i have tried other benchmark, and it seems that actionscript 3.0 perform 10 to 100 TIMES FASTER then actionscript 2.0 , only for this one it run slower... why?
I also attach all the code for actionscript 3.0
should you want to try the actionscript 2.0 , just uncomment the ConvertXML and this.onEnterFrame for actionscript 2.0 and comment the one for actionscript 3.0
Why? have i done something wrong?
Cheers and God Bless,
Chowi
Attach Code
var StartTime:Number = getTimer();
var EndTime:Number = getTimer();
var MyXMLString:String = "<?xml version='1.0'?><member><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O><O><member_id>1</member_id><currency_id>0</currency_id><name>Administrator</name><description>Account Administrator</description><contact>-</contact><billing_info>-</billing_info><opening_payable>0.0000000000</opening_payable><opening_receivable>0.0000000000</opening_receivable><type>STAFF</type><asset_chart_of_account_id>0</asset_chart_of_account_id><liability_chart_of_account_id>0</liability_chart_of_account_id><staff_username>administrator</staff_username><staff_password>21232f297a57a5a743894a0e4a801fc3</staff_password><staff_privileges>ADMIN</staff_privileges></O></member>";
var MyXML:XML = new XML(MyXMLString);//Parse the XML ONCE
var j:Number = 0;//This Variables used for ActionScript 3.0 Loop
var k:Number = 0;//This Variables used for ActionScript 3.0 Loop
/*
//Action Script 2.0 ConvertXML
function ConvertXML(RecvXML:XML, ChildBranch:Boolean, IsTable:Boolean):Array {
var RowArr:Array = new Array();
for (var aNode:XMLNode = RecvXML.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
var TempRecord:Object = new Object();
for (var bNode:XMLNode = aNode.firstChild; bNode != null; bNode=bNode.nextSibling) {
TempRecord[bNode.nodeName] = bNode.firstChild.toString();
}
RowArr.push(TempRecord);
}
return RowArr;
}
this.onEnterFrame = RunXML;
*/
//Action Script 3.0 ConvertXML
import flash.xml.*;
function ConvertXML(RecvXML:XML, ChildBranch:Boolean, IsTable:Boolean):Array {
var RowArr:Array = new Array();
for (j=0; j<RecvXML.child("*").length(); j++) {
var TempObject = new Object();
for (k=0; k<RecvXML.child("*")[j].elements("*").length(); k++) {
TempObject[RecvXML.child("*")[j].elements("*")[k].name()] = RecvXML.child("*")[j].elements("*")[k];
}
RowArr.push(TempObject);
}
return RowArr;
}
addEventListener(Event.ENTER_FRAME, RunXML);
function RunXML(Events:Event){
StartTime = getTimer();
for(var i:Number=0;i<100;i++){
var MyXMLArr:Array = ConvertXML(MyXML, false, false);
}
EndTime = getTimer();
trace(EndTime - StartTime + " ms");
}
Edited: 10/09/2008 at 12:17:57 AM by M4G1C14N
URGENT How Do I Get Actionscript To Pause Actionscript 2.0
Hi guys,
sorry to repost, I know its an annoying thing to do, but this is pretty urgent on a project I'm doing.
I need the actionscript to carry out a piece of code, then pause for 0.5 seconds, then carry out the next piece of code, then pause, then next code e.t.c
There will be twenty pieces of code that build up an animation with tweens that need to start at different times.
I guess its something to do with setInterval, but I'm not sure on the syntax, as there 20 pieces of code I don't want lots of nested code (though if thats the only way to do it then so be it!)
I'd really appreciate your help guys
cheers
Help: This Works In Actionscript 1 But I Need It To Work In Actionscript 2
I have some scrolling navigation that works when published using actionscript 1 but not actionscript 2. I need to use actionscript 2 because it supports the streaming video that I'm trying to navigate. Can someone help me rewrite my button logic to get the scroll bar to work as it did in actionscript 1? Please see my fla if necessary, but here is the area I need help with.
if (Number((getProperty("../scrollhandle", _y)))>Number((Number(../:top)+Number((../:speed/(../:height/../:scrolllength)))))) {
setProperty("../scrollhandle", _y, (getProperty("../scrollhandle", _y)-(../:speed/(../:height/../:scrolllength))));
} else {
setProperty("../scrollhandle", _y, ../:top);
}
tellTarget ("../scrollhandle") {
gotoAndPlay(3);
}
the error that I get is:
**Error** Symbol=buttonlogic, layer=Layer 1, frame=2:Line 1: Operator '>' must be followed by an operand
if (Number((getProperty("../scrollhandle", _y)))>Number((Number(../:top)+Number((../:speed/(../:height/../:scrolllength)))))) {
**Error** Symbol=buttonlogic, layer=Layer 1, frame=2:Line 2: Operator '-' must be followed by an operand
setProperty("../scrollhandle", _y, (getProperty("../scrollhandle", _y)-(../:speed/(../:height/../:scrolllength))));
**Error** Symbol=buttonlogic, layer=Layer 1, frame=2:Line 4: Unexpected '.' encountered
setProperty("../scrollhandle", _y, ../:top);
Please help if you can.
Actionscript 3 Tutorials For Actionscript Beginners
hey all, looking for some tutorials on actionscript 3 for people who are relatively new to actionscript altogether? Finding loads of tutorials but they seem to expect u to already have a grasp of actionscript 2!!
cheers in advance!
Works In Actionscript 1.0, Not Actionscript 2.0, Help?
Any idea why this would work fine in Flash MX but not MX 2004 Pro? I'm new to the upgrade but I can't imagine why this doesn't work.
_root.mission.gotoAndStop("mission");
I'm publishing in Actionscript 1.0 so I don't see what the difference would be.
Thank you much!
Converting ActionScript 1 To ActionScript 2
Flash keeps giving me a "type mismatch" error for this particular line of code:
myItemArray[x] = parseInt(Math.random()*9) + myItemArray[x];
Based on my research it's because it's old script and I'm not sure how to go about converting it so I don't get the error. I've pasted the entire block of code for your understanding. Thanks in advance for you help.
Code:
//Build array
myItemArray = new Array("a1","a2","a3","a4","a5","a6","b1","b2","b3" ,"b4","b5","b6");
for(var x = 0; x < 12; x++){
myItemArray[x] = parseInt(Math.random()*9) + myItemArray[x];
}
//Sort array
myItemArray.sort();
//Strip off random num at beginning
for (var x = 0; x < 12; x++){
myItemArray[x] = myItemArray[x].substr(1,myItemArray[x].length);
}
Works On ActionScript 1.0 But Not On ActionScript 2.0
The following code works if you have your flash file set to:
Flash Player 6
Action Script 1
I need it to work for
Flash Player 7
Action Script 2
What it does is that basically if i have
1 2 3 4 5
and i click on the 5 it will arrange the movie clips so they will be
5 1 2 3 4
mc is the name for action script of the movie clip i'm using
I think
the function that doesn't work correctly is the move function
HOW CAN I FIX THIS Sad
Code:
var acceleration = 12;
var friction = 0.7;
clipArray = [];
posArray = [];
for (var k = 0; k<5; k++) {
myclip = attachMovie("mc", "mc"+k, k);
myclip._y = 100;
myclip._x = 170+myclip._width*k;
//myclip.myText.text = "Button "+k;
clipArray.push(myclip);
//countArray.push(k);
posArray.push(myclip._x);
myclip.onPress = dostuff;
}
function move() {
var xdif = posArray[this.jvar]-this._x;
this.xspeed += xdif/this._parent.acceleration;
this.xspeed *= this._parent.friction;
this._x += this.xspeed;
this.checkDistance();
}
checkDistance = function () {
if (Math.abs(posArray[this.jvar]-this._x)<1) {
this._x = posArray[this.jvar];
delete this.onEnterFrame;
}
};
function dostuff() {
for (var i = 0; i<clipArray.length; i++) {
// setting indexes
clipArray[i].ivar = i;;
}
// deleting the mc the user clicked
k = clipArray.splice(this.ivar, 1);
// the mc you click is on the front
clipArray = k.concat(clipArray);
for (var j = 0; j<posArray.length; j++) {
// re setting the indexes
clipArray[j].jvar = j;
trace(clipArray[j]+" "+clipArray[j].jvar);
// calls move
clipArray[j].onEnterFrame = move;
}
}
Actionscript 2.0 Convert To Actionscript 3.0
Hello Everyone,
I have the code below which was created for Actionscript 2.0... I was hoping someone could help me convert to Actionscript 3.0.
If there is anyone that could help me out I would greatly appreciate it.
Thanks,
Alan
var mouse_control:Boolean = true;
var speed:Number = 0;
var mouse_force:Number = 100;
map_color_mc.gotoAndStop("1");
var stop_motion:Boolean = false;
var front_map_position:Number = front_map_mc._x=0;
var reverse_map_postion:Number = reverse_map_mc._x=0;
var centerX:Number = Stage.width/2;
point_mc.duplicateMovieClip("point_mc2", -16367);
point_mc2._x = point_mc._width;
point_mc2._y = point_mc._y;
this.onEnterFrame = function() {
if (stop_motion == false) {
if (mouse_control) {
speed = ((_xmouse-centerX)/mouse_force);
}
front_map_position += speed;
reverse_map_postion -= speed;
if (front_map_position>0) {
front_map_position = -(front_map_mc._width/2);
}
if (front_map_position<(front_map_mc._width/2)*-1) {
front_map_position = 0;
}
if (reverse_map_postion>0) {
reverse_map_postion = -(reverse_map_mc._width/2);
}
if (reverse_map_postion<(reverse_map_mc._width/2)*-1) {
reverse_map_postion = 0;
}
point_mc._x = front_map_mc._x=front_map_position;
point_mc2._x = point_mc._x+point_mc._width;
reverse_map_mc._x = reverse_map_postion;
}
};
globe_hit_mc.onRollOver = function() {
if (mouse_control == false) {
stop_motion = true;
}
};
globe_hit_mc.onRollOut = function() {
if (mouse_control == false) {
stop_motion = false;
}
};
Importing Actionscript Into Actionscript
I've got a game and I've got too much actionscript.
So I'm wondering if it's posible to import an external actionscript file into the code on the maibn SWF file.
This would also give the user a chance to edit basic vaiables, eg. speed, jumpHeight etc.
Any ideas?
Set Movieclips's Actionscript Using Actionscript
Right now, I have a button that attaches a movie clip. However, I need to attach some code to the movie clip, once it's been added. How would I do that?
Edit: Otherwise, would there be any way to automaticly attach it to any movie clip sharing the same instance name?
|