Search Amazon.com:
Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us $3,400 per month for bandwidth bills alone, and since we don't believe in shoving popup ads to our registered users, we try to make the money back through forum registrations.
«2 »
  • Post
  • Reply
nolen
Apr 4, 2004

butts.


rotor posted:

Also, with the Macromedia compiler, this happens:

code:
function foo(){
  var x = "butts";
  if(true){
    var x += 1;
  }
  trace(x);
}
The output isn't "butts," like in every rational language I've ever used, but is rather "butts1." Even more shocking, many built-in Macromedia classes rely on this stupid behavior. MTASC fixes that.


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.

Adbot
ADBOT LOVES YOU

nolen
Apr 4, 2004

butts.


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

nolen
Apr 4, 2004

butts.


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?

nolen
Apr 4, 2004

butts.


rotor posted:

First, I'd make really, really sure this is something you HAVE to do, because it will add all kinds of complexity.

maybe, although I'm not sure why you'd bother using XML instead of an .as file. You can pull in new code with JSON:

http://json.org/json.as

or with your method. Neither one has the ability to UNload code, AFAIK.

If there's nothing on the stage of that movie, who cares if it's on the the screen?



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.

nolen
Apr 4, 2004

butts.


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.

This breaks a pretty common theme in this thread about keeping all your code in one place, but it seems pretty straightforward to me.

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?

nolen
Apr 4, 2004

butts.


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);
				
				
			}
		}
	}
}
The line in bold throws up this error message:

"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?

nolen
Apr 4, 2004

butts.


rotor posted:

prev is undefined outside of the j>0 block.

If it compiled, it'd barf because on the first pass through that loop innerCirc[prev] is undefined because prev is undefined, because it never enters the j>0 branch.

The fact that AS2 let you get away with it and punts it to the runtime is an abomination unto the lord and I bitched about it plenty back on the first few pages.

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

nolen
Apr 4, 2004

butts.


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:falsedirx:0diry:-1rot:-90dir:"up"};
keys[Keyboard.DOWN] = {down:falsedirx:0diry:1rot:90dir:"down"};
keys[Keyboard.LEFT] = {down:falsedirx:-1diry:0rot:-180dir:"left"};
keys[Keyboard.RIGHT] = {down:falsedirx:1diry:0rot:0dir:"right"};


stage.addEventListener(KeyboardEvent.KEY_DOWNdownKeys);
stage.addEventListener(KeyboardEvent.KEY_UPupKeys);
stage.addEventListener(Event.ENTER_FRAMEonFrame);

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.+= speed*keyOb.dirx;
                box.+= 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;
                }
            }
        }
    }
}
?>
I understand that this is happening because technically the angle for the LEFT direction is less than the current angle when facing down (-180 and 90, respectively). What I'm curious about is how to accomplish proper rotation without having specific handlers for each direction. Wouldn't I need to use something like the distance formula and check it against 180, then use that to determine which direction to rotate?

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.

nolen
Apr 4, 2004

butts.


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

nolen
Apr 4, 2004

butts.


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.

The clip is playing and omit trace actions is UNchecked.

is there something new about AS3 I'm missing here?

So I understand your problem, your trace action is called on a frame inside the clip that's nested inside another nested clip?

nolen
Apr 4, 2004

butts.


milkaxor posted:

I'll just throw out the question and see what happens.

I have an embedded flex/as3 application that is 300 x 300. I would like to have a component expand past the bound of the application and overlay the rest of the information in the page. Here is what I want to do. I want to have a small application that has a bunch of buttons for added functionality. When I click one of those buttons I would like it to bring up a window that is 500x500. If it do that currently, it will be clipped by the application border. Is there anyway to make it so that this is possible?

Someone recommeneded making clipContent false on the application - but that doesn't work. All the child components are still clipped.

Here is a lovely test app I have right now. All it does is display a popup on button click.

code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    width="400"
    height="400">
    
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            
            private function Button_Click() : void
            {
                Alert.show("test");
            }
        ]]>
    </mx:Script>
    <mx:Button x="167" y="209" label="Click Me" click="Button_Click()"/>    
</mx:Application>
Is there anyway to get the popup to be outside the bounds of the application, or to have a titlewindow be larger than the application? If I can't do it in flex then how would I do it? I believe I've seen flash apps that have taken over the browser window. I'm not certain though.

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.

nolen
Apr 4, 2004

butts.


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:
<div>
	<embed type="application/x-shockwave-flash" src="yourSwfHere.swf" 
               width="someWidth" height="someHeight">
</div>
for each .swf and then use scriptaculous (or whatever other framework you choose. Hell you could write it all yourself if you wanted) to do the fancy overlapping stuff.

nolen
Apr 4, 2004

butts.


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?

I think that was just a long-winded way of asking "can I pass startup params to a swf?"

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.

nolen
Apr 4, 2004

butts.


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).

Upon doing this, I am receiving this error on export - 1046: Type was not found or was not a compile-time constant: Void.

?

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:

my_FLVplybk.addEventListener(VideoEvent.STOPPED, handlerFunc);

function handerFunc(e:VideoEvent):void
{
    //do stuff
}

nolen
Apr 4, 2004

butts.


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.

nolen
Apr 4, 2004

butts.


milkaxor posted:

That makes me so sad. Also, the other 5% doesn't live in LA or doesn't want to leave their current situation.

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.

nolen
Apr 4, 2004

butts.


EonBlueApoc posted:

Flex Actionscript 3

In a class "myClass" I have an ArrayCollection "allItems" chock full of objects, each with a "source" property. I also have a bindable ArrayCollection "myCollection" declared with the default constructor.

In my main.mxml there is a ComboBox in state3 with the dataProvider property set to myCollection. This is enough to throw a couple warnings on the <mx:ComboBox/> Object:
"Data binding will not be able to detect assignments to myClass"
"Data binding will not be able to detect assignments to myCollection"
I didn't think that was an issue since I wouldn't be using any assignment on myCollection, only .addItem and .removeAll

During runtime in state1 of my application I have the user select the sources they wish to see. After state1 I fill myCollection with objects from allItems that have a source property that match from the selected sources using .addItem. When I get to state3 my ComboBox is perfect.

However, I provide an option to go back to state1 and begin again. When this is done I call .removeAll on myCollection and have the user re-choose their sources.

It seems that after continuing past state1 the first time, my combobox gets locked with the items compiled into myCollection during that iteration. If I return to state1 and a new source is selected and the originals removed, items from the new source will be added to the ComboBox, but the items from the new (removed and not readded to myCollection) remain displayable.

What am I doing wrong? Is there something wrong with my Data Binding? Why does it work the first time? Is there a different solution?

Thanks for your time.

Can you post the relevant portions of your code?

nolen
Apr 4, 2004

butts.


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:
mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" horizontalAlign="center" initialize="init()">
	<mx:Script>
    <![CDATA[
      import mx.collections.ArrayCollection;

      [Bindable] private var collection:ArrayCollection;
      
      private var t:TestClass;
      
      private function init():void
      { 
        t = new TestClass();
        collection = t.myCollection;
      }
    ]]>
  </mx:Script>
  <mx:ComboBox width="200" dataProvider="{collection}"/>
</mx:Application>


TestClass.as:

package
{
	import mx.collections.ArrayCollection;
	
	public class TestClass
	{
		public var allItems:ArrayCollection;
		
		public var myCollection:ArrayCollection;
		
		public function TestClass()
		{
			init();
		}
		
		private function init():void
		{
			// populate allItems with random objects
			allItems = new ArrayCollection();
			myCollection = new ArrayCollection();
			for(var i:int = 0; i<100; i++)
			{
				allItems.addItem(i);
			}
			
			for each(var j:int in allItems)
			{
				if(j%5 == 0)
				{
					myCollection.addItem(j);
				}
			}
			
			//trace(myCollection);
		}

	}
}
This seems to work just fine for me.

nolen
Apr 4, 2004

butts.


iopred posted:

Yeah, there's been lots of Flex questions asked around these parts.

I recommend hitting a good AS3 book first, Flex is nice for designing screens, but eventually you have to tie a lot of it together with AS3.

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.

nolen
Apr 4, 2004

butts.


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.

nolen
Apr 4, 2004

butts.


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.

nolen
Apr 4, 2004

butts.


Lamb-Blaster 4000 posted:

problem is reversed, then. The stage's event listener stops doing poo poo when the mouse is over the object.

I guess both functions could run the same code, but that seems like a less elegant workaround.

Care to post your code?

It should trigger the mouse move event regardless of what it's over when the stage is listening.

nolen
Apr 4, 2004

butts.


Erasmus Darwin posted:

That's odd. I created a test version, and it seems to work just fine:

code:
code
If I move the mouse anywhere within the Flash application, it turns bright red whether or not the mouse is over the object. Could the object being used in your code somehow be causing the MOUSE_MOVE not to reach the stage?

Yeah this is almost exactly what I did and my test is working as well.

nolen
Apr 4, 2004

butts.


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?

nolen
Apr 4, 2004

butts.


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/

nolen
Apr 4, 2004

butts.


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.

nolen
Apr 4, 2004

butts.


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.



code:
FLCmd("SetQuality", "high");
mo = FLCmd("GetDateMonth");
dd = FLCmd("GetDateDay");
ww = FLCmd("GetDateWeekday");
hh = FLCmd("GetTimeHours");
mm = FLCmd("GetTimeMinutes");
ss = FLCmd("GetTimeSeconds");
if (mo <= 9)
{
    mon1:num = 0;
    mon2:num = substring(1, 1)mo, ;
}
else
{
    mon1:num = substring(1, 1)mo, ;
    mon2:num = substring(2, 1)mo, ;
} // end else if
if (dd <= 9)
{
    day1:num = 0;
    day2:num = substring(1, 1)dd, ;
}
else
{
    day1:num = substring(1, 1)dd, ;
    day2:num = substring(2, 1)dd, ;
} // end else if
weeks:num = substring(1, 1)ww, ;
if (hh <= 9)
{
    hour1:num = 0;
    hour2:num = substring(1, 1)hh, ;
}
else
{
    hour1:num = substring(1, 1)hh, ;
    hour2:num = substring(2, 1)hh, ;
} // end else if
if (mm <= 9)
{
    min1:num = 0;
    min2:num = substring(1, 1)mm, ;
}
else
{
    min1:num = substring(1, 1)mm, ;
    min2:num = substring(2, 1)mm, ;
} // end else if
setProperty("short", _rotation, hh * 30 + mm * 0.5);
setProperty("long", _rotation, mm * 6 + ss * 0.1);
setProperty("second", _rotation, ss * 6);
    


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.

nolen
Apr 4, 2004

butts.


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/

nolen
Apr 4, 2004

butts.


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.

nolen
Apr 4, 2004

butts.


rotor posted:

it's expensive as gently caress for a legitimate commercial license is one reason

That is quite the good reason.

nolen
Apr 4, 2004

butts.


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.

nolen
Apr 4, 2004

butts.


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.

nolen
Apr 4, 2004

butts.


Dogcow posted:

code:
textfield.text += "\n";
Should work. It's probably because of the leading being so small.


Similar to this solution, increase the size of the textfield only if textfield.numLines is equal to 1.

nolen
Apr 4, 2004

butts.


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 cannot seem to figure out any less cumbersome way than this:

code:
public function getMyBounds():Rectangle {
		//jesus de christo, look at this mess.  Adobe, you are terrible
//note: 'this' is the custom UI element that is a child of the right-hand pane		
		var pane:DisplayObject = getMxmlObject(["box"]);//this gets a ref to the HDividedBox
		var divBox:DividedBox = DividedBox(pane);
		var div:BoxDivider = divBox.getDividerAt(0);//only got one divider
		var width:int = pane.width - div.x - div.width - 2 * divBox.getStyle("horizontalGap"); //this still isn't right, it's off by a few pixels
		return new Rectangle(0,0,width, this.parent.height);//note that this assumes we have the whole vertical distance to ourselves, ugh, but whatever

	}
This can't be right. Anyone got a cleaner implementation?


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?

nolen
Apr 4, 2004

butts.


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:



that duck image is added as a child of a child of the left-hand area:

code:
stuff



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.

nolen
Apr 4, 2004

butts.


rotor posted:

w00t, thx, tryin' this tomorrow

the whole right side of the HDividedBox.

The panel seems to just be the size of whatever I jam into it, regardless of the size of its container.


Well, it's my own component and i have to do wacky things on a resize - it's sort of a zoomable interface that takes special handling.

What if you set the maxHeight and maxWidth of the panel? Does it still resize to its content?

nolen
Apr 4, 2004

butts.


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?).

nolen
Apr 4, 2004

butts.


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.

nolen
Apr 4, 2004

butts.


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.

Adbot
ADBOT LOVES YOU

nolen
Apr 4, 2004

butts.


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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply
«2 »