ActionScript 3.0 :: Declaring Var Session:FacebookSessionUtil; Causes No Error
Nov 6, 2009
My project has become rather large from just libraries that i've needed to include in my project in order to do what i need to do. I needed webservices, so i included some flex lib's, and I needed facebook information, so I included the facebook API. Just from those libs and a small game, my swf is about 513k, that seems rather large to me... As soon as I include: var session:FacebookSessionUtil;
into my code, in a function or as a class member, I get the error "You cannot debug this SWF because it contains ActionScript". without that line of code, it compiles and works; thus there is a lot of actionscript in my opinion. If i uncomment that line, then everything works again.
I have several movieclips that I exported to actionscript from the library (c01,c02,c03,...)In the actions I have a conditional that checks a variable and depending on the variable provided I want to create a new instance of that movieclip. For example if cityY==1 then I want to create a new c01.
I tried with conditional and with a switch/case but I get an error declaring the newCity variable more than once.[code]...
So, I have encountered a very bizarre scenario involving const declarations. I'm curious if anyone else has seen this as well. Note that this only happens when the game in question is loaded as an external swf.Here's my runtime error:
Code: ReferenceError: Error #1074: Illegal write to read-only property my.game.sidescrolling:BGBase::POINT on my.game.sidescrolling.Background.
We have deployed a flex application on Tomcat and it uses Blaze-DS to communicate with the Java side. However when using the deployed application we constantly get the error:Detected duplicate HTTP-based FlexSessions, generally due to the remote host disabling session cookies. Session cookies must be enabled to manage the client connection correctly. url...Within our Apache httpd.conf we have set up a proxy lookup so that rather than using particular ports (e.g 8082) we want to use port 80 (some of our customers operate in a locked-down environment).[code]
I am a novice in Facebook developer by choosing ActionScript 3 as my developer platform. I use SWC library from official facebook-actionscript-api that promoted by Adobe.So I followed their tutorial.[code]
I am using a pixelbender kernel to create a custom ShaderFilter in my standalone project it works fine, but once I build the changes into my main project I recieve "Packages cannot be nested" error. The following line is causing the problem
[Embed(source="./assets/pbfilters/ColorBalance.pbj")] private var CBByteCode:Class;
This is within an AS3 class which is being imported into a flex module extending the TItleWindow class. I prefer to avoid using the URLloader to bring the bytecode into the file.
What I want to achieve is pretty basic: I have an input text with instance name (contact_date) and I want the information the user enter in this input field to be kept in a variable that I can reuse later on in my movie.
I have 26 buttons in my library named BUTNA, BUTNB, BUTNC, etc. all the way to BUTNZ.
I want the script to pick a random button from the library and place it on the stage.
I am probably doing this wrong, but I am lost.In my script, I need the variable btnp1 in place of BUTNZ in line 8.I don't know how to do this.[code]...
I have a simple math game where the user enters his answer and clicks a button. The problem I am having is that if the answer is wrong, the numbers in the question do not change on the screen but but in the actionscript, the variables being used to check the answer change. How do I get the variables to stay the same when the user's answer is wrong? Not redeclare all of the variables.
Code: var num1:uint = Math.Random()*1000; var num2:uint = Math.Random()*1000; var sum1:uint = num1 + num2;
I want to declare on multiple numerated variables like this:
var myVar1; var myVar2;
But I don't want to do this manually for every variable instance but automatically, so I need a way to instruct the compiler to declare by himself on every variable and to numerate them automatically.
So hopefully I explained myself well, I wanted to know if there is such way to do this?
If you declare an instance of an object with out assigning it a variable, does it stay in memory or does flash automatically garbage collect it? For example if I just keep using new Date().getTime() to update a persons time from his/her system clock with out assigning it a variable will instances of Date() objects just keep piling up in memory or is it ok to do this?
I have a question about assigning instance names. How do I set a Loader's instance name so I can refer to it outside of the function (without using event.target or event.currentTarget or event.target.name)? Here's an example...I'm writing this on the fly...
in as2 you used to be able to just declare a variable on a movieclip something line myMC.newvar= "something". this does not seem to work in as3 I get undefined property. Am I missing something on how to dynamically declare variables to sprites and movieclips?
I have this little flash movie, that goes full screen when you launch it, there's a big button in the middle that says "Press here", when you press it the screen goes black, and a movie starts playing.
When I run this NOT in fullscreen it works like a charm. The problem is though when I run it in fullscreen it freezes a frame before the movie.
Here's the error I get when debugging: ReferenceError: Error #1056: Cannot create property ryt on flash.display.Stage.
From what I googled I understood that this was caused because somehow the movie clip is set to private, and flash can not access it.
The solution is to declare this movie clip public.
That's where my AS3 knowledge ends, I tried "public var ryt;" but then it says I have to declare this in some package.
I know how to easeIn a movieClips property using something like: this._x+=(Xvalue-this._x)/5 so it gradually slows down. But what would I use to make it start slow then speed up?
I am guessing something like: Code: var speed =20 this.onEnterframe=function(){ this._x+=(Xvalue-this._x)/speed speed-- if(Math.abs(Xvalue-this._x)<1{ this._x=Xvalue speed=20 delete this.onEnterFrame }} But trying this on multiple mcs and it goes wack because speed is constantly changing. How can I declare the speed var for each onEnterFrame?
This will sound odd, but I would like to find a way for Flash to declare one instance of each class inside a package. That is to say, if a package com.rezmason.stuff contains five classes, some code makes an instance of each class in an array; but if, later on, I take out two classes, that same code only makes an instance for each of the three remaining classes within the package. Later still, if I add seven classes, the same code makes an instance fore each of those ten classes.
I doubt that this is possible, but I figured that if anyone would know, it would be you folks. Code with this kind of flexibility would greatly simplify managing the code in a project that frequently has classes being added, removed and swapped. If anyone has an idea, I'd like to hear it.
I was wondering what the rules are for declaring variables which you would increment say in an for loop. I tried to declare a variable outside the for loop, and then increment it within the loop but that didn't work.
What is the difference between declaring a variable like this: variable = 1; and declaring it like this: var variable:Number = 1? Why is it better to use the second way?
New here with emphasis on noob. I have started doodling with flash back in CS but increasingly been having a blast since I installed CS5. In all that time I have avoided Ascript like the plague. Now I find myself wanting to do things that require it. I have spent days searching the internet and this forum for a simple way to stop an swf from playing more than once per session in a format that I can understand. Everything seems to be old posts or if I find something I can't get it to work. Remember, you guys are waaay ahead of me on script. I vaguely understand the concept of sharedObject (as a result from my search) and cookies. I'm just having trouble with putting the whole thing together to make it work.
I would think this would be a great function for adobe to include in the code snippets window. I sure they have their reasons if its not. If it is however just tell me where it is and I'll go on avoiding actionScript
I have made a website and put inside it a flash game. For people to play the game they have to log into the website. Logging to the website will create a session. I want for the flash game to get the session id, so I have created a function that gets the session id. It works only in Internet Explorer and when I tried it in Chrome, it didn't retrieve the session id. I have written a php file that will be used by the as3 to get the session id, the php code is this:
Although I have a long experience with AS2, I am just stepping in AS3 now. As should be expected, I have bumped a few issues here and there, that really puzzles me.
One of them is the way to correctly name a variable dynamically. In AS2, as far as I know the only way to do that is with _root, like that:
Code: for (var z=0;z<=5;z++) _root["myvar"+z] = z;
I have used quite the same way to do that in AS3, like that:
Code: for (var z=0;z<=5;z++) root["myvar"+z] = z;
However, it doesnt seem to be too good, because it just allows me to create global variables. What if I want to create local vars into the function? I tried to remove the "root" and use "var" statement but ActionScript doesnt like that (it tells me that there is an identifier missing before the left bracket):
Code: for (var z=0;z<=5;z++) var ["myvar"+z]:Number = z; // Flash yelds when I try that!
What is the trick to do that... or simply THERE IS NOT a way to do that, but always declare dynamic vars as public??