ActionScript 2.0 :: Unable To Make The Code Short?
Aug 7, 2009in making this code short
ActionScript Code:
function addlist() {
var dataload = new LoadVars();
[code].....
in making this code short
ActionScript Code:
function addlist() {
var dataload = new LoadVars();
[code].....
I am using the following code in many places, like you can see, there is m1,m2, m50,m51 m100 etc, it means i have 100 movieclips(in example below, there are 10 mcs only). [code]...
View 3 RepliesI'm trying to take into account the Garbage Collector (GC), so I decide to optimize this code:[code]For instance, is it useful to put "xmlOne = null" in every iteration? I'm checking with the Flashdevelop's profiler, but I don't see the difference.maybe, I can also reuse the item object rather than creating it every time, right?
View 1 RepliesDoes anyone have ideas to securely encode a small amount of data into approximately 8 characters? I have a project (Flash and Flex (AS3) not that it really matters) that must be deployed on CD/DVD-ROM (no local storage nor network access) but with a requirement to allow people to come back where they left off. Therefore there will need to be a code that is human-friendly to print (on dead-tree or PDF) or write down and to enter back into an input field, as well as being secure to stop cheating between different students.
There are 14 assessment items that can be completed in any order. At the moment I CRC32 their "login name" and take 16 bits from that result, and combine them with the 14 assessment bits into 30 bits that is then encoded using a form of Base32, giving 6 characters, then adding a check character, then using a character replacement for encryption. Upon return to the program and entering the 7 character progress code, after decryption and extraction, if there is a match in the name hash parts, it is assumed the completion bits are correct.
One problem identified was that only two characters change when completing each item. Is there some algorithm that would completely change the entire string if any one bit changes? Or is there a completely better way? I'd also like to store more data (dates, more bits for the hash to reduce collisions, location within the course, etc) but don't want to go above 8 or 10 characters.
I want to be able to display a paragraph where if the text being shown is (say) over 15 lines long, then a link text will appear and if click it will expand.
Example:
This is a long line for here so I need to make more display but I cant so what will (More)... <== this more link will be clicked and the rest will show up below this paragraph expanded to show the rest of it. (Close)... <== this close link will be clicked and the rest of the page will be hidden again.
Can this be done in Flex? Here is a link example done in javascript [URL].
When I click the check mark, message 'The script contains no errors'When I click the Auto format button, message 'This script contains syntax errors, so it cannot be Auto Formatted.ix the errors and try again.'I've never had these two buttons disagree.Code compiles normally and everything works.
View 2 RepliesI have a site that plays either .mp3 or .flv files depending on what is selected from the menu. Menu loads in from xml. I get "unable to make connection with server or unable to find flv on server" when I try to play the video. But the video and audio files are all in the same directory and the mp3 files play fine. I think I'm having a problem with the setMedia command. Here's the code that loads the video and audio files.
[Code]...
I have a trial version of the Adobe Flash CS5 installed on my machine and I am unable to get code hinting to work when I'm working on AS3 files. I've tried doing the reg fix from Lee's blog but still can't get it to work. I've also tried deleting the Flash regkey and the configuration folder but still can't get it to work.
Specs:Windows 7 64
Intel Core 2 Duo E7200
4GB RAM DDR
I'm using URLLoader to POST to a server. The xml response from the server can respond with a 404 or a 403 (forbidden) error. However I am unable to get the response codes.
Here is the code
var urlString:String = "some url";
var urlRequest:URLRequest = new URLRequest(urlString);
var loader:URLLoader = new URLLoader();
[Code]....
status is always 0 regardless whether i return 200, 400, 404, 301, 500, etc...
Following error is arising if I use NavigatorContent in Repeater. Is there a way to initialize image and lable on which I am encountering following error: Unable to generate initialization codewithin Repeater, due to id or databinding on a component that is not a visual child.
Code:
<mx:Repeater id="rep" dataProvider="{usersArray}">
<s:NavigatorContent width="100%" height="100%" label="{rep.currentItem.name}" >
[code]....
var Xpos:Number = 110;
var Ypos:Number = 180;
var swf:MovieClip;
[code]....
I have on the last frame of my external swf code like this:
unloadMovie(this);
//
I think this should unload my external swf from my main movie
And now in my main movie I want to check if my container is empty.. if it is.. let's go to some other frame..
if (container == 0) {
main.gotoAndPlay(2);
}
//
I was just hoping that this code checks if the container is empy.. and sends the main movie to frame 2 ..
I am new to flash and creating a file with a series of 25 images. I have each image on its own keyframe in the stage1 and I have buttons for: play_btn, stop_btn, next_btn, prev_btn My next and prev buttons work ie...
[Code]...
but I am unable to get any AS3 code to work as a Mouse.Click to play the series of keyframes. Every time I try to add a gotoAndPlay to the play_btn my file just starts a continuous loop.
im making a platform game project but as of yet im still un able to make the camera move up and down when the charater jumps or stands on a platform?
[Code]...
Im new to AS but Im working everyday to improve, Im trying to make a menu but Im having difficulties with moving the menu:
I have a bar in 500 length and mask of 100 And I have 5 buttons. When I click 1 ofthem I want it to bring the correct positon of the bar with easing. Btw the registration point of thebar is upper left corner
I was wondering how to do the box effect like on [this] site. The lines move up and across to form a box. I have tried a few things that I could think of, but have't got it.
View 2 RepliesI have a grid that is drawn by the graphics library. I have small pieces, let's call them blocks that are the shape of a square. These blocks connect to each other to form pieces. I want the user to be able to rotate the pieces and then snap them to the grid.I've looked at the geometry libraries but I'm unsure how I would get the points of each square in a piece to match it up with the board after it has been rotated
View 5 Replieshow to make a countdown timer? I created a timer that counts down to a certain date, but I just want the timer to countdown 24 hours, not to a certain date. I also want to have a button below the timer so that when you click it, it adds 30 seconds to the timer
View 6 Repliesi wanna make a dynamic tree using a lazy loading ,each time i open a folder the tree sends a http request to the server, in this script i'm using just static text to test the tree but , i'm getting in the label of the root all the XML text assigned to the dataprovider, then when i open the root folder i got the childs with good labels , and openitem and closeitem events do not fire how could i make them
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
[code].....
I have a movie clip button that has 3 states:up, over, out, and press.the action script inside the movie clip button looks like this:
stop();
onRollOver = function () {
this.gotoAndstop("_over");
[code]....
I have this face that says something when u rollover it, in this case for example: hi kirupians!! , what I need is to have some different texts,
View 4 Repliescreate a counter using actionscript? the scene is 30 frames long and it's sopposed to get a new value with every frame. something like counter++; example: 70% should turn 71%, 72%.... 100% (but not as a preloader animation)
I tried it, using the while loop like this in first frame:
while (counter < 100)
{
[code].....
Why cant i make a variable in a function? like this:
aiBunny = function (target)
{
var target.hp:Number = 15;
target.interval = setInterval (aiFoe, 24, target);
};
i download and try to modify a xml photo gallery from kirupa in this pagemake the buttons for "next" "back".... and one button that control the slide show, but i cant find how to activate the slide show and desactivate it.
View 1 RepliesI have a flash fullscreen and in ie it works. However the problem in firefox is that sometimes the image is centered but sometimes not (it goes to the bottom-right corner). How can I fix that?
View 1 RepliesDoes anybody know how to apply this text effect(including the blinking underscore) to a text field that loads from an external .txt file.
View 6 Repliesi have an flash file, where i am calling script from the ".as" file. this works fine.Inside the flash file there is no code. All the codes is in the ".as" file. that's ok.But when i change the code into the ".as" file. that code doesn't works. To make that code work i have to re hit the "CTRL+ENTER" than that code works.I have changed the classpath also $(LocalData)/Classes.What i am looking for is, once i made an ".as" file, than i edit that ".as" file without opening the fla file. That code should work.
View 6 RepliesI have a bunch of MovieClip Symbols in Library. They all need to import the same classes for timeline code. I don't want to add the import statements to every MovieClip's timeline.
View 2 RepliesI'm not sure how to handle IOErrorEvents when I don't have access to the loader. I have a textfield to which I assign htmltext containing an img link:
ActionScript Code:
try {
displayBox.htmlText = htmlwithimages;
[code].....
I have an app wer i drag and drop images onto a canvas and then move them on the canvas to arrange them appropriately. After that i shud be able to click on those images and draw connectors between them as the user seems required. But after dragging and dropping the images on the canvas and arranging them, when i click on the image i am getting a typeerror 1009 error, i.e, "cannot access a property or method of a null object reference".
Actually after arranging the images, i add an event listener to the image(proxy) on the canvas:
image.addEventListener(MouseEvent.CLICK, mouseClickk);
image.addEventListener(MouseEvent.DOUBLE_CLICK, mouseUpp);
MouseClickk Function:
[Code].....