A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Easy for you: How to get parameter

Hybrid View

  1. #1
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You need to change the parameter in the embed tag too.

    As for the multiple values thing, you could do it with flashvars by passing multiple name-value pairs.

    flashvars="labelx=Regions&labely=Profit&xnames=Sou th|Nord|East|West&yvalues=100|200|500|600"

    You'll have to parse out the arrays using the split method, and then turn the resulting array of Strings into an array of Numbers.

    You could also do it with ExternalInterface after the swf has loaded, and pass in proper javascript objects. There are pros and cons each way.

    Also, it looks like you're not providing any x values, so make sure your chart does something intelligent in that case like equally spacing the data points.

  2. #2
    Junior Member
    Join Date
    Nov 2008
    Posts
    6
    Thanks Flax for your time

    Yes you're right! Never do things manually, when Dreamweaver can do it right for you ;-)

    With a little help from this tutorial
    http://www.flepstudio.org/forum/tuto...flash-cs3.html

    I was able to make it run. Here is the coding:

    Code:
    
    
    package {
    	import flash.display.Sprite;
    	import flash.text.TextField;
    	import flash.display.LoaderInfo;
    	import flash.text.TextField;
    	import flash.text.TextFormat;
    	import flash.text.TextFieldAutoSize;
    
    	public class Main extends Sprite {
    		private var id:String;
    		private var _MemText:TextField;
    
    		public function Main() {
    			configureMemText();
    			getHTMLvars();
    		}
    		private function getHTMLvars():void {
    			var value:String;
    			var obj:Object=LoaderInfo(root.loaderInfo).parameters;
    			for (value in obj) {
    				id=String(obj[value]);
    				_MemText.text=id;
    			}
    		}
    		private function configureMemText():void {
    			_MemText=new TextField  ;
    			_MemText.autoSize=TextFieldAutoSize.LEFT;
    			_MemText.background=true;
    			_MemText.border=false;
    
    			var format:TextFormat=new TextFormat;
    			format.font="Verdana";
    			format.color=0xFF0000;
    			format.size=12;
    			format.underline=false;
    			format.bold=true;
    
    			_MemText.defaultTextFormat=format;
    			addChild(_MemText);
    		}
    	}
    }
    Thanks for your suggestion with the arrays. Hmm, I'm sure that works, but it would be nice, if you could just pass an array to AS... Would that be possible with 'ExternalInterface'? Havent heard about this one... Hmm, do you have any resources/link where I could find out how to use it for my prob?

    Thanks for the hint with the coordinates. My project is a custom radar chart. I've got the major shape and drawings but a bit stuck with my math skills :-) But first things first ;-)

    Thanks again
    GSub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center