|
rotor posted:Also, with the Macromedia compiler, this happens: This would work in the Macromedia compiler if you set a type for the variable. The old way Flash handled variables, it allowed type changes on the fly. I loving hated it and I think AS 2.0 was a fantastic step in the right direction.
|
| # ¿ Mar 27, 2007 06:15 |
|
|
| # ¿ May 25, 2013 11:07 |
|
So I'm working on a game at the moment and I'm having some trouble accessing a variable declared in my main Game class from a separate Item class. Essentially, I have an object holding the getBounds info for my hero movieclip that was declared in my Game class file and I need to access my hero's getBounds info in my Items class without declaring another variable to hold my hero's getBounds info. I know it sounds really confusing, but I can post code for anyone truly wanting to help. PM me if you'd like or message me on AIM @ poopypunk. edit: figured it out. NameOfClass.variablename works just fine as long as I've set that variable as static public. nolen fucked around with this message at Jul 4, 2007 around 08:28 |
| # ¿ Jul 4, 2007 04:51 |
|
I have a project that I'm currently working on that is dynamically setup via an XML document. Each level pulls it's data from individual nodes in that XML document. This way it knows what items to put on the screen, what background image to load, etc. What I'm trying to figure out, is how to load/unload individual scripts depending on what level is currently loaded. Say the current level == hotel, so I would want to load scripts that are specific to the hotel level. Maybe my hero walks offscreen and into the alley level. I would need to unload the scripts from the hotel and then load the scripts specific to the alley. I know that I can include .as files at COMPILE time, but is there a way to pull the code at runtime? Could I store the actual actionScript in the XML file and pull it from there? <level id="hotel" description="looks like a stinky hotel from the movies" code="door._x+=5;"> </level> Is something like the above code possible or "allowed"? From what I understand, you can create an empty .swf with nothing but code and just loadMovie it into the scene, but that also puts the stage of that movie on the screen. Is there a way to load JUST the scripts from that .swf? Would that be a better solution for my situation?
|
| # ¿ Jul 12, 2007 01:46 |
|
rotor posted:First, I'd make really, really sure this is something you HAVE to do, because it will add all kinds of complexity. Well perhaps I'm going about this the wrong way. I'm making an adventure game, ala King's Quest or Hugo's House of Horrors. There will be different puzzles for each room, and I'm just curious how I should handle something like that.
|
| # ¿ Jul 12, 2007 02:30 |
|
DrOuD posted:You could load an external room movie, then have that movie load the code from the XML into itself. Then when leaving a room, just unload that movie and start over with the next room. Currently I have my code in three class files, Game.as, Level.as, and Item.as. Then comes the levelData.xml file that stores all my specifics for each level. The only code I have in the Flash document is a line creating an instance of the Game class and another line calling Game.run(). I've considered creating separate .as files for each level, and only have their code run when the current level is set to their specific value. For example, if currentLevel=="hotel" then run the code from hotel.as. That feels like it is "improper". Am I correct to think that?
|
| # ¿ Jul 12, 2007 15:58 |
|
This is probably newbie issue with AS3, but I've never run into something like this in AS2. I'm using the fisix engine to construct a "blob", similar to gish or loco roco. CODE:package
{
import com.fileitup.fisixengine.collisions.DetectionModes;
import com.fileitup.fisixengine.constraints.StickConstraint;
import com.fileitup.fisixengine.core.FisixObject;
import com.fileitup.fisixengine.particles.CircleParticle;
public class Blob extends FisixObject
{
public var cent:CircleParticle;
public function Blob(x:Number,y:Number)
{
//set properties
bounce = 1;
friction = 0.5;
innerCollisions = true;
setDetectionMode(DetectionModes.HYBRID_RAYCAST);
// our center circle, which all other circles surround
cent = newCircleParticle(0, 0, 6);
// draw the particles on the screen
drawCircle(50);
setCenter(x,y);
}
public function drawCircle(radi:Number):void
{
var detail:Number = 20;
var angle:Number = Math.PI * 2 / detail;
var rad2:Number = radi/4;
var innerCirc:Array = new Array();
var outerCirc:Array = new Array();
for (var i:Number = 1; i <= detail; ++i)
{
var x:Number = Math.cos (angle * i) * radi;
var y:Number = Math.sin (angle * i) * radi;
var x2:Number = Math.cos (angle * i) * (radi+rad2);
var y2:Number = Math.sin (angle * i) * (radi+rad2);
var c1:CircleParticle = newCircleParticle(x, y, 2);
innerCirc.push(c1);
var c2:CircleParticle = newCircleParticle(x2, y2, 2);
outerCirc.push(c2);
}
for(var j:Number = 0; j<innerCirc.length; j++)
{
var inner:CircleParticle = innerCirc[j];
var outer:CircleParticle = outerCirc[j];
if(j>0)
{
var prev:CircleParticle = innerCirc[j-1];
}
var skinStick:StickConstraint = newStickConstraint(inner, outer)
addConstraint(skinStick);
var centStick:StickConstraint = newStickConstraint(inner, cent);
addConstraint(centStick);
[B]var innerStick:StickConstraint = newStickConstraint(outer, innerCirc[prev]);[/B]
addConstraint(innerStick);
}
}
}
}
"TypeError: Error #1009: Cannot access a property or method of a null object reference." From what I've gathered, it means that the object I'm referencing doesn't exist in memory yet but I don't see how that can be since the array I'm pulling from was created and filled up before this loop even started. I can explicitly call an index in the array and the code runs fine, but if I use the iterator (j+1 or even j-1) then it freaks out. Is this something incredibly easy that I'm missing?
|
| # ¿ Dec 21, 2007 07:13 |
|
rotor posted:prev is undefined outside of the j>0 block. Ack. Good eye. I declared it under the proper scope and moved the bold line from above into the if statement. Same error though. I'm going to feel like a moron once I find out what I'm doing wrong. post bowl-of-cereal edit: Yup, I'm a moron and was calling things when they weren't existing. All fixed now. Thanks again. nolen fucked around with this message at Dec 21, 2007 around 10:57 |
| # ¿ Dec 21, 2007 10:33 |
|
I'm working on some rotation/movement code where you press an arrow key, the clip rotates to the desired angle, and then moves in the desired direction once it has reached said angle. I'm having an issue forcing the clip to rotate in the proper direction towards the desired angle. http://www.nolentabner.com/test/keytest.swf If you follow the link above, press and hold the arrow keys to move and rotate the clip around the stage. Try rotating the clip all the way until it's facing down then press and hold the LEFT arrow key. Instead of rotating to the left, the clip rotates all the way around (counter-clockwise) until it is facing left. Code: php:<? var speed:int = 3; var dir:String = "right"; var targetDir:String = " "; var keys:Object = new Object(); keys[Keyboard.UP] = {down:false, dirx:0, diry:-1, rot:-90, dir:"up"}; keys[Keyboard.DOWN] = {down:false, dirx:0, diry:1, rot:90, dir:"down"}; keys[Keyboard.LEFT] = {down:false, dirx:-1, diry:0, rot:-180, dir:"left"}; keys[Keyboard.RIGHT] = {down:false, dirx:1, diry:0, rot:0, dir:"right"}; stage.addEventListener(KeyboardEvent.KEY_DOWN, downKeys); stage.addEventListener(KeyboardEvent.KEY_UP, upKeys); stage.addEventListener(Event.ENTER_FRAME, onFrame); function downKeys(e:KeyboardEvent):void { if(keys[e.keyCode] != undefined) { keys[e.keyCode].down = true; targetDir = keys[e.keyCode].dir; } } function upKeys(e:KeyboardEvent):void { if(keys[e.keyCode] != undefined) { keys[e.keyCode].down = false; } } function onFrame(e:Event):void { //trace(dir+" "+box.rotation+" "+targetDir); for each(var keyOb:Object in keys) { if(keyOb.down == true) { // if we are already at our target direction, move ahead if(box.rotation == keyOb.rot) { dir = keyOb.dir; box.x += speed*keyOb.dirx; box.y += speed*keyOb.diry; } else { // if our desired angle is less than our current angle, decrease if(keyOb.rot < box.rotation) { box.rotation -= speed; } // if our desired angle is greater than our current angle, increase else { box.rotation += speed; } } } } } ?> Sorry if this is lengthy, I just want to make sure it's understandable. Check the .swf and you will see what I'm trying to accomplish.
|
| # ¿ May 5, 2008 19:25 |
|
While we're on the subject of sockets, I'm currently attempting a proof-of-concept ftp client in flex/AIR and have encountered a bit of trouble. I can connect to the server just fine using binary arrays, but I'm having issues using all the raw ftp commands, for example: LIST. This probably has more to do with me not understanding FTP as much as it does sockets, but I figured I would throw this out there. It's my understanding that FTP requires two socket connections, one for control and one for data. If I create a separate socket for data, it still seems to bring up nothing. Anyone tried something similar to this before? Edit: Got this fixed thanks to some advice in the General Programming Questions thread. I wasn't listening for DATA on the data socket, I was listening for responses. Listened for responses on the control socket and data on the data socket and now everything is beautiful. nolen fucked around with this message at Jun 12, 2008 around 18:24 |
| # ¿ Jun 11, 2008 20:12 |
|
Dog Named Duke posted:[AS3]I have a movieclip embedded in another clip which is embedded in another clip which is on the stage. Tracing does not show up when I trace from a frame. Code only ever seems to run if it's broken. So I understand your problem, your trace action is called on a frame inside the clip that's nested inside another nested clip?
|
| # ¿ Jun 12, 2008 21:17 |
|
milkaxor posted:I'll just throw out the question and see what happens. Let me see if this is what you're asking: * You have a an application, that when compiled is a 300 x 300 .swf. * You want to be able to load up a component (Panel, TitleWindow, whatever) into that .swf but have it extend beyond the dimensions of said .swf file and overlap the rest of the content in the browser window. As in, overlap the html content that's already on the page? If this is true, it's not really possible with one .swf file but definitely possible with some fancy javascript. You could embed your swfs inside divs and use localConnection to communicate between the two if needed.
|
| # ¿ Jul 13, 2008 02:05 |
|
milkaxor posted:That is exactly what I am asking. I had feared that what I wanted wasn't simple. Now I need to learn javascript and try out what you said in your reply. Thanks. If you know AS3, then javascript will be a piece of cake for you. For fancy effects and whatnot, check out scriptaculous, a js framework that makes said effects MUCH easier to achieve. You'll just need to do something like: code:
|
| # ¿ Jul 13, 2008 07:51 |
|
milkaxor posted:Now would each overlapping piece have to be in it's own swf? Let say I have the main swf and it has 3 buttons - each one invoking a different action and each action needs overlap the "parent" swf. Can I have all 3 actions in a ssecondary swf and then just pass the swf startup params? Yeah you can use FlashVars to pass values to the .swf upon loading. Otherwise as mentioned earlier, localConnection will let multiple .swfs talk to each other during runtime. Adobe's documentation is pretty good at explaining both of these if you aren't familiar with them.
|
| # ¿ Jul 13, 2008 17:19 |
|
Treytor posted:Thanks for the quick response! Since there is no existing actionscript in this project, and all I have is one FLVPlayback in the library (the actual movie), I assume I am supposed to set your 'my_FLVplybk' to my actual object (FLVPlayback). If this is an actionscript 3.0 file, 'Void' has been changed to 'void' and event listeners are setup a little different than what is shown in that example. Something similar to: code:
|
| # ¿ Jul 18, 2008 17:27 |
|
I use FlexBuilder all the time at work. While it's definitely geared toward web forms and the like, it can handle pure AS3 projects as well, and gives you all the nice code completions and hinting. If I'm assigned any actionscript project, I'm going to start it out in FlexBuilder. Nothing beats the way it handles debugging compared to any other IDE. On the days where I have to work with an .fla from one of our artists, I use FlashDevelop. If you have no use for the extras that FlexBuilder offers (like the Design View to setup forms and such), I say stick with FlashDevelop. It's using the same compiler and libraries, AND it's free.
|
| # ¿ Jul 20, 2008 19:21 |
|
milkaxor posted:That makes me so sad. If only I weren't in Phoenix. I have the opposite problem when looking for actionScript-related jobs. Most of them are graphic-heavy and no real programming is involved.
|
| # ¿ Aug 8, 2008 16:57 |
|
EonBlueApoc posted:Flex Actionscript 3 Can you post the relevant portions of your code?
|
| # ¿ Aug 15, 2008 16:37 |
|
EonBlueApoc posted:stuff Your bindable tag isn't going to do much inside that class. You need to create a pointer to the myCollection inside your class. Something like this: code:
|
| # ¿ Aug 15, 2008 18:38 |
|
iopred posted:Yeah, there's been lots of Flex questions asked around these parts. I tore through Flex for Developers (Friends of Ed) and then watched every single lynda.com Flex video. They compliment each other fairly well and will get you up to speed if you already know AS3.
|
| # ¿ Sep 16, 2008 16:01 |
|
rotor posted:ps: it's hard to find actual flash engineers everywhere, most flash people are artistes who happened to learn programming accidentally. My boss is having the same problem. I'm the first person he's hired that actually knows AS3 and Flex, but it's starting to look like I'm the only one in the Phoenix Metro area. Some of the mock projects he gets are just atrocious from a programmer's perspective.
|
| # ¿ Oct 23, 2008 21:56 |
|
rotor posted:The flash compiler is trash and you shouldn't rely on it to do anything more than not crash too frequently. Just another reason to use Flex Builder. I don't know how I ever lived without it for debugging and the like.
|
| # ¿ Nov 10, 2008 20:19 |
|
Lamb-Blaster 4000 posted:problem is reversed, then. The stage's event listener stops doing poo poo when the mouse is over the object. Care to post your code? It should trigger the mouse move event regardless of what it's over when the stage is listening.
|
| # ¿ Nov 19, 2008 18:25 |
|
Erasmus Darwin posted:That's odd. I created a test version, and it seems to work just fine: Yeah this is almost exactly what I did and my test is working as well.
|
| # ¿ Nov 19, 2008 19:10 |
|
I'm being asked to possibly write out a fairly large project for a contractor and I'm not sure what to quote the guy. The project details are as follows: * Custom web app written that talks to their mySQL database and displays entries on a calendar, sorted by date. * Each entry will be a link to a media piece, which then opens a media player above the calendar * Search bar to find entries based on user input This is the first project I've ever had potentially fall into my lap and I'm not sure how much a project of this caliber would normally cost a person. It's not going to be overly difficult for me to achieve their end result, but it is definitely going to take some time. Any thoughts?
|
| # ¿ Jan 27, 2009 18:36 |
|
terminatusx posted:I think amfphp will be of use to you here. And by "think", I mean "know". ZendAMF might be better since it's the "official" solution for this type of thing now. http://framework.zend.com/
|
| # ¿ Mar 31, 2009 01:44 |
|
Subedei posted:I never worked with Flex before but you don't have to use movie clips in Flash except the document class? What does Flex offer for me that Flash CS4 doesn't? * cheaper * a better IDE * a real debugger You could argue that Flash CS4 + FlashDevelop gives you the same thing, so it's really down to personal preference.
|
| # ¿ Mar 31, 2009 06:17 |
|
Vulcan posted:I made a flash movie that works fine, and I tried to put a clock in it that reads the time from the system clock. I get a poo poo ton of syntax errors when I compile it, and while the movie plays fine, the clock reads 00:00 and doesnt move an inch. Are you using colons as part of the variable name? Because that's definitely not allowed in flash. Otherwise, are you trying to type those variables as Numbers? Then you need to use varname:Number not varname:num.
|
| # ¿ Apr 2, 2009 22:12 |
|
fankey posted:Any idea if Flash 10 will have better support for this sort of thing? I'm not sure about the answer to your question but you can check the Flash 10 docs here since it's out: http://help.adobe.com/en_US/AS3LCR/Flash_10.0/
|
| # ¿ May 21, 2009 22:39 |
|
Is there any reason why you couldn't use the Google Maps API? http://code.google.com/apis/maps/documentation/flash/ You'd need to tweak it a bit to support the wheel for zooming in and out, but everything else seems to be there.
|
| # ¿ Jul 9, 2009 16:44 |
|
rotor posted:it's expensive as gently caress for a legitimate commercial license is one reason That is quite the good reason.
|
| # ¿ Jul 9, 2009 22:34 |
|
Have you tried using a different image format? Maybe a lossless one like PNG? Flash has always been weird with JPG files for me, so I've just stuck with PNGs mostly. It could possibly be a make-shift solution for you.
|
| # ¿ Jul 13, 2009 23:20 |
|
Erasmus Darwin posted:There are claims floating around (including on Slashdot) that the Wii browser is now free and supports Flash 9. The former is true, but a bit of digging shows that the latter isn't. The browser actually supports Flash Lite 3.1, which it can't handle AS3. Yeah it's basically the equivalent of Flash 8.
|
| # ¿ Sep 2, 2009 17:10 |
|
Dogcow posted:
Similar to this solution, increase the size of the textfield only if textfield.numLines is equal to 1.
|
| # ¿ Sep 3, 2009 17:49 |
|
rotor posted:Ok so I'm finally starting on the as2->as3 translation. I'm building most of the gui in flex, but the main application is this custom UI element stuck in one side of a HDividedBox. I need to resize it in a weird way, so I need to find out how big the visible area of the right hand side of the pane is. I'm a bit confused on what you're trying to do. Any chance you could rig up a quick diagram to help explain the scenario?
|
| # ¿ Nov 6, 2009 16:04 |
|
rotor posted:bonus question: why is an image I add as a child of the HDividedBox not clipped to the visible region?? I mean, honestly, wtf m8: This problem will probably be solved by setting the clipContent property of the Panel to true. As for your first problem, you want to find the size of the whole right side of the HDividedBox or the size of the Panel inside it? Most components you place inside of a HDividedBox will resize according to the properties you set when it's initialized. You shouldn't have to manually resize an object as you move the divider bar.
|
| # ¿ Nov 11, 2009 07:57 |
|
rotor posted:w00t, thx, tryin' this tomorrow What if you set the maxHeight and maxWidth of the panel? Does it still resize to its content?
|
| # ¿ Nov 11, 2009 15:17 |
|
Stringent posted:flash develop ( free, windows only ) is the best actionscript ide available. macs suck for flash simply because they can't run it. other than that i can't tell much difference between windows and mac. I use FlashDevelop (and the Unity variant, UnityDevelop) on my Mac all the time via virtualization and it works great. But to the OP, I wouldn't say that you're missing out on anything Flash-specific by not owning a Mac. I use a Mac because I prefer the OS over Windows and my workflow is easier to setup this way. If your preference is Windows and you feel like you're more efficient with that OS, find a good editor and keep on trucking (flashing?).
|
| # ¿ Jan 8, 2010 17:31 |
|
Squirrel007 posted:Trying to make a "wrapper" for the child movie. Ill probably just stop messing with it though, looking like it isnt going to work. The error you're receiving is because the code on that frame is executed before the textbox is instantiated in the player. If the textbox exists on a frame before the code, it would work. I do agree with lostatsea though, and recommend keeping all your actions on one frame. The timeline is a bitch once you start trying to control it.
|
| # ¿ Feb 9, 2010 23:42 |
|
Lumpy posted:Well, I did my stuff in CS4, and it was easy and looked great. However, the agency I was freelancing for wants CS3 files... so papervision it is. Anyone have experience w/ papervision? I have what I need to do workign in a ruimentary fashion, but A) it looks like poop (jaggy) and B) the texture is off-center, despite the Plane being the same size and the artwork being centered.... A: you can set the material's smoothing property to true and this should fix the jaggies B: How are you creating the plane? Feel free to post your code. Papervision can be a real nightmare if you're just learning it.
|
| # ¿ Mar 5, 2010 17:14 |
|
|
| # ¿ May 25, 2013 11:07 |
|
Lumpy posted:That's exactly what I said... "the time you save on this project alone will more than pay for the $199 upgrade..." But I guess change is scary or something. But speaking of change, now they want the spinny thing to be an actual 3d extruded object! If this is the case, you might as well model it out and import it into Papervision as a DAE file. It'd save you the headache with the textures as well.
|
| # ¿ Mar 5, 2010 20:58 |






Should work. It's probably because of the leading being so small.