Actionscript Methodology
this is a pretty general question about when to use actionscript and when to use plain tweening/frame-by-frame animation techniques. im working on a site that, after the preloader, goes through a maybe 4 second transition to the homepage and has subsequent 1-2 second transitions between the other pages. my question here is, in your experience, is it better to do page transitions using actionscript to control the movement of various objects, or is placing movie clip objects and using tweening/framebyframe a better way to go? my main concern here is with reducing file size and choppiness.
i guess this question boils down to: is actionscripting ALWAYS necessarily better (from an optimization POV) than oldschool flash animation methods?
discuss.
FlashKit > Flash Help > Flash ActionScript
Posted on: 06-09-2003, 05:31 AM
View Complete Forum Thread with Replies
Sponsored Links:
Design Methodology....?
Hi All,
I am wondering...
With the main components of any movie being:
Movies
Movie Clips
Scenes
Preloaders
(is there more :P ???)
How / what is the best way to link them all together into one seemless transitional masterpiece.
Is there a proven 'rule of thumb' design methodology for peicing together a final movie..???
or am i asking for the recipe to the scret herba and spices
Appreciate your insight
Cheers !
View Replies !
View Related
Architecture And Methodology
I have a question for anyone who would like to tackle it.
A project in front of me involves a map with nearly 100 different buttons, irregular size. When the user rolls over a button, the area must fade in and out smoothly, and the tween must not be compromised by a premature roll-out. The tween must continue to run it's course.
With a few buttons, this could be achieved by having a boolean flag in the button 'over' and 'out' states, and playing various states of a subordinate mc, that correspond to value of the flag.
What do you think is the best way to go about building this for such a large number of buttons?
View Replies !
View Related
Dimension Methodology…
If the goal is to achieve optimal speed and performance, when embedding a flash file into a html is it better to design the flash element to be the size you want it, say 800x600 – or - Build it smaller, say 640x480 and rescale it in html: width="800" height="600"?
View Replies !
View Related
Multiple MC Methodology
I'm trying to sequentially attach 37 separate MC's into one scene but I'm having trouble getting the next MC into the main scene after the very first has played. Any suggestions on methodoogy to follow in this situation? Place an instance of each MC on the stage and then proceed frame by frame? Stick a little script at the end of each MC attaching the next MC? Can an array hold MC's? Just trying to look before I leap.
View Replies !
View Related
Your Methodology In Debugging
Hi there, just registered to this forum so I'm NEW.
I have, however, used this forum for information and learnt from the tutorials. Good content!
Anyways, I have a question about debugging a movie---in particular, where and how you guys set breakpoints.
The reason why I'm inquiring about this is because I find it very inefficient to debug. I have to basically set breakpoints in every line of ActionScript to have it traverse through the lines of code.
I come from a VB background and in the debug mode in Visual Studio or any VBA IDE, it halts itself to even step through calling functions within another function or routine.
In Flash it doesn't do this. In order for me to traverse through the steps of any calls or line of ActionScript, I have to place breakpoints where I want to be able to step through.
Am I missing something?
I'd appreciate anyone enlightening me on how debug more effectiviely. After all, its the most effective way of learning ActionScript.
Thanks in advance for your comments.
VBC
View Replies !
View Related
Your Methodology In Debugging
Hi there, just registered to this forum so I'm NEW.
I have, however, used this forum for information and learnt from the tutorials. Good content!
Anyways, I have a question about debugging a movie---in particular, where and how you guys set breakpoints.
The reason why I'm inquiring about this is because I find it very inefficient to debug. I have to basically set breakpoints in every line of ActionScript to have it traverse through the lines of code.
I come from a VB background and in the debug mode in Visual Studio or any VBA IDE, it halts itself to even step through calling functions within another function or routine.
In Flash it doesn't do this. In order for me to traverse through the steps of any calls or line of ActionScript, I have to place breakpoints where I want to be able to step through.
Am I missing something?
I'd appreciate anyone enlightening me on how debug more effectiviely. After all, its the most effective way of learning ActionScript.
Thanks in advance for your comments.
VBC
View Replies !
View Related
Multiple Swf With Multiple Image Load Methodology.
I can't seem to get my head on straight tonight.
My scenario is this…
One main site frame swf and one swf per page, I have a small pre-load anim for the frame itself and one nice pre-load anim in the main frame to use with the subsequent pages.
In the default page I am loading right at the start I have an image gallery with several images loaded using a single MovieClipLoader instance. I'd like to monitor the load of the page and the image loads using the root level preload anim I'm wondering if using a single MovieClipLoader am I precluding this from working since the loads are happening concurrently.
How would/do you handle situations like this?
Thanks,
J.
View Replies !
View Related
[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 =(
View Replies !
View Related
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);
}
}
View Replies !
View Related
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?
View Replies !
View Related
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?
View Replies !
View Related
[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
View Replies !
View Related
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
View Replies !
View Related
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!
View Replies !
View Related
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
View Replies !
View Related
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?
View Replies !
View Related
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
View Replies !
View Related
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
View Replies !
View Related
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.
View Replies !
View Related
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);
}
View Replies !
View Related
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;
}
}
View Replies !
View Related
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;
}
};
View Replies !
View Related
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?
View Replies !
View Related
Actionscript 2.0 → Actionscript 3.0
Hi,
Since I'm no expert in it, it took me time to get used to some Actionscript 2.0 codes. Now I'm trying to work on Actionscript 3.0, but I don't know that much about it. I have a script that I want to convert from 2.0 to 3.0. Here it is:
ActionScript Code:
g_list.addItem({label:"Wikipedia", data:"Wikipedia"});
g_list.addItem({label:"Yahoo", data:"Yahoo"});
var listHandler:Object = new Object();
listHandler.change = function(ntt:Object) {
switch (ntt.target.selectedItem.data) {
case "Wikipedia" :
getURL ("http://www.wikipedia.org");
break;
case "Yahoo" :
getURL ("http://www.yahoo.com");
break;
default :
trace("unhandled event: "+ntt.target.selectedItem.data);
break;
}
};
g_list.addEventListener("change", listHandler);
Can anyone help me, please?
View Replies !
View Related
Migrate Actionscript 3 To Actionscript 2
Hello,
I have a problem migrating from AS3 to AS2.
I have the following code:
class Main extends MovieClip {
var g1:Graph;
function Main() {
g1 = new Graph(); // I create a new instance on Graph
addChild(g1); //add it to this movieclip
g1.startup(); //in startup I add several instances on Elem to g1
}
function updateElems()
{
for(var i:Number = 0; i < g1.numChildren; i++)//I iterate through childrens to update them
{
var elem:Elem = g1.getChildAt(i) as Elem;
elem.update();
}
}
}
I create an AS3 project and associate the stage to the Main class that adds a child - g1 - of type Graph using addChild(), then I add several Elem instances to Graph using addChild().
While running I need to update the Elem instances so I iterate through g1's children of type Elem, using getChildAt(i=0, numChildren).
I need to port this to AS2
In AS2
- there's no fl.core.UIComponent (I've used mx.core.UIComponent)
- mx.core.UIComponent doesn't have getChildAt and addChild methods
The questions are:
a) how can I add Main class to stage as I cannot link it from the user interface as this feature is only supported with as3?
b) how can I add g1 to Main?
c) how can I add instances of Elem to g1
c) how can I iterate through the children of g1, the Elem instances and update them?
Thanks!
View Replies !
View Related
Actionscript 3 Support Actionscript 2?
Hi
I would want to ask whether if currently, all the object, functions, classes in actionscript 2 can be rewritten in actionscript 3?
E.g (its just an example), actionscript 2 have Math class, and actionscript 3 also has Math class??
Hope everyone here can understand what I mean. Thanks.
View Replies !
View Related
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
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;
}
}
View Replies !
View Related
ActionScript 2.0 To ActionScript 1.0 Using Flash 8
Hi there, I've a contact form with input fields, but, in some area of this form I've placed a combobox drop down menu, wich is a component, I'm using flash 8, so everything was working fine untill my client saids he needs that working in Actionscript 1.0 and the movie published for the flash player version 6, in my button I've this code
on (release) {
Enquiry = (comboBox1.getSelectedItem().label);
_root.test.text = este;
gotoAndPlay("gracias");
this.loadVariables("contacts.php", "POST");
}
thing here is because of the player version update now my dropdown menu is not working, just wondering if somebody can help me with this?
Thanks a lot!!
Arturo
View Replies !
View Related
Actionscript 1.0 To Actionscript 2.0 Conversion, Help
Hi guys,
Straight to the point. I found this skewing prototype in laco tweener web. And it was in actionscript 1.0 can u convert this code so its compatible with flash8 & actionscript 2.0 please? I can't seem to know what's wrong in here that I cant play it in as2.
------------------------------------------------------------------------------
var mp = MovieClip.prototype;
mp.setXskew = function(value) {
var _xskew = value;
//this._xskew = value;
//
var _yskew = this._yskew;
// add properties to movieclip
if (!this.inner_mc) {
// defines inner_mc clip needed to skew
for (var clips in this) {
if (typeof (this[clips]) == "movieclip") {
this.inner_mc = this[clips];
// finds first movieclip and uses it to skew
break;
}
}
if (!this.inner_mc) {
return trace("No interior clip for skewing found in "+this._name+".");
// error if inner not found
} else {
this.inner_mc._rotation = -45;
}
// assure clip is rotated -45 degrees
}
var toRads = Math.PI/180;
// converts degrees to radians
var xr = _xskew*toRads;
// skew in radians
var yr = _yskew*toRads;
var cosxr = Math.cos(xr);
// cosine of skew
var cosyr = Math.cos(yr);
this._rotation = 45+(_xskew+_yskew)/2;
// rotate this clip accordingly
var div = Math.sin(this._rotation*toRads)*.707106781186547;
//div: divisor - sin rotation *sin 45 degrees;
if (!div) {
div = .0000001;
}
// prevents dividing by 0 which you just... cant... do
this._xscale = 100*(Math.sin(yr)+cosxr)/div;
// scaling for skew
this._yscale = 100*(Math.sin(xr)+cosyr)/div;
this.inner_mc._yscale = this.inner_mc._xscale=50/cosyr;
// scaling inner to maintain width/height
// = base_yscale*.5/cosxr;
};
ASSetPropFlags(mp, "setXskew", 1, 0);
//
mp.getXskew = function() {
return this._xskew;
};
ASSetPropFlags(mp, "getXskew", 1, 0);
//
mp.setYskew = function(value) {
var _xskew = this._xskew;
//
var _yskew = value;
//this._yskew = value;
// add properties to movieclip
if (!this.inner_mc) {
// defines inner_mc clip needed to skew
for (var clips in this) {
if (typeof (this[clips]) == "movieclip") {
this.inner_mc = this[clips];
// finds first movieclip and uses it to skew
break;
}
}
if (!this.inner_mc) {
return trace("No interior clip for skewing found in "+this._name+".");
// error if inner not found
} else {
this.inner_mc._rotation = -45;
}
// assure clip is rotated -45 degrees
}
var toRads = Math.PI/180;
// converts degrees to radians
var xr = _xskew*toRads;
// skew in radians
var yr = _yskew*toRads;
var cosxr = Math.cos(xr);
// cosine of skew
var cosyr = Math.cos(yr);
this._rotation = 45+(_xskew+_yskew)/2;
// rotate this clip accordingly
var div = Math.sin(this._rotation*toRads)*.707106781186547;
//div: divisor - sin rotation *sin 45 degrees;
if (!div) {
div = .0000001;
}
// prevents dividing by 0 which you just... cant... do
this._xscale = 100*(Math.sin(yr)+cosxr)/div;
// scaling for skew
this._yscale = 100*(Math.sin(xr)+cosyr)/div;
this.inner_mc._yscale = this.inner_mc._xscale=50/cosxr;
// scaling inner to maintain width/height
//
};
ASSetPropFlags(mp, "setYskew", 1, 0);
//
mp.getYskew = function() {
return this._yskew;
};
ASSetPropFlags(mp, "getYskew", 1, 0);
//
mp.addProperty("_xskew", mp.getXskew, mp.setXskew);
ASSetPropFlags(mp, "_xskew", 1, 0);
mp.addProperty("_yskew", mp.getYskew, mp.setYskew);
ASSetPropFlags(mp, "_yskew", 1, 0);
delete mp;
------------------------------------------------------------------------------
and here's the code for the press button.
#include "lmc_tween.as"
//
skew_btn.onPress = function() {
squares_mc_xskew = random(180);
squares_mc.tween("_xskew", squares_mc_xskew, 1, 'easeInOut');
//
squares_mc_yskew = 180;
squares_mc.tween("_yskew", squares_mc_yskew, 1);
};
------------------------------------------------------------------------------
Thanks in advance!
View Replies !
View Related
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
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;
}
}
View Replies !
View Related
Converting Actionscript 1.0 To Actionscript 2.0
Last edited by funkyflash : 2006-01-18 at 11:06.
This code goes in Frame 1:
ActionScript Code:
// script by Jae Young, Choi
// on Designers Forum (corea)
Movieclip.prototype.elasticScale = function(target, accel, convert) {
xScale = xScale * accel + (target - this._xscale) * convert
yScale = yScale * accel + (target - this._yscale) * convert
this._xscale += xScale
this._yscale += yScale
}
This code goes on the movieClip:
ActionScript Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
elasticScale(150, .75, 0.1)
trace ("x=" + xscale)
trace ("x2=" + (target - this._xscale))
} else {
elasticScale(100, .75, 0.1)
trace ("x=" + xscale)
trace ("x2=" + (target - this._xscale))
}
}
View Replies !
View Related
ActionScript 2.0 To ActionScript 3.0 Migration
Here's a Livedoc published by MM giving an overview of the differences between 2.0 and 3.0. This is geared as a reference for Flex 2.0, but I would assume that this would apply as well to anyone who's going to be jumping into 3.0 with Flash.
Big and exciting changes. ActionScript is really shaping up to be a serious platform language. Long live Flash!
http://livedocs.macromedia.com/labs/...migration.html
View Replies !
View Related
Actionscript 1.0 To Actionscript 2.0 Problem
ok my problem may or may no be something you guys can help me with... i downloaded a preloader tutorial from actionscript.org and i love the preloader but the problem is it doesn't work with actionscript 2.0 or at least that's what i think is the case. as it is right now i can't figure out any other reason other then the fact that it was created on flash mx and i use mx 2004. the reason i think it's a difference between AS 1.0 and 2.0 is that when i just transfer my documents and everything directly into the tutorial page, format it to the same size and everything, the preloader works but the easing code i use doesn't, and if i'm not mistaken that's something for AS 2.0. is there a way i can convert the script over? i'm not sure how to do it really if anyone knows can you help? here it is:
ActionScript Code:
onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndPlay(2);
}
}
View Replies !
View Related
Actionscript To Javascript ..any Actionscript Hero Or Javascript Guru?
Hi..everybody..
i just like to know..if anyone could tell me is it possible to pass a variable from actionscript to javascript ?
eg.
password = inputName
login = login
boolean gate == fales;
if (password == "temp" && login =="login"){
answer = "Access granted!" ;
getURL("temp.html",_self);
} else {
answer = "Access denied!" ;
}
because my login page was made in flash..however, after i found out that user could type in url direct access to the web, i made a redirect meta tag ,redirect that web to login page..however, its does work out..because those 2 pages are not passing login success to another...>__<
thanks you..
anythingokay
View Replies !
View Related
Can Anyone Convert This Actionscript 2.0 Code To Actionscript 3.0 Code ?
Hi, I'm a graphic designer and I've used this system since the last two years. I would like to convert it on to actionscript 3.0 but I am not a programmer. Can someone help me please? Thank you!
on(rollOver){
txt.gotoAndPlay("entrada")
}
on(rollOut){
txt.gotoAndPlay("salida")
}
on (release) {
_parent.navegate("clip01")
if (_parent.anterior != "occitane") {
_parent[_parent.anterior].gotoAndPlay("salida");
}
_parent.anterior = "occitane";
_root.navigate("occitane");
}
================================================== ===
function navigate(destino) {
if (firstime != false) {
_root.currentSection = destino;
_root.gotoAndPlay("salida");
firstime = false;
} else {
_root.currentSection = destino;
_root.contenedor.gotoAndPlay("salida");
}
}
================================================== ===
salida = "salida00"
function navegate(destino){
this.destino=destino
this.gotoAndPlay(salida)
salida = "salida" + destino
//salida = "salida" add destino
}
stop()
================================================== ===
fscommand("showmenu", "false");
fscommand("allowscale", "false");
Stage.scaleMode = "noscale";
//-----------------------
var StageWidth:Number = 1000;
var StageHeight:Number = 546;
function escalaFondo()
{
if (Stage.width > Stage.height) {
fondo._width = Stage.width;
fondo._yscale = fondo._xscale;
} else {
fondo._height = Stage.height;
fondo._xscale = fondo._yscale;
}
fondo._x = (StageWidth - fondo._width) / 2;
fondo._y = (StageHeight - fondo._height) / 2;
}
//-----------------------
Stage.addListener(this);
this.onResize = escalaFondo;
escalaFondo();
//-----------------------
View Replies !
View Related
|