Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




How Strong Is Type Casting



I have a variable saved in the first frame of my fla file
var question:Number = 0;


I want to make it possible for sombody to jump around in the exersice so I built kind of a jumper and saved it in its own mc. In the mc I have a button called jump with the following code.

_root.question = q.text;

Now that question will work but when I tried to add one to my question variable it did something weird. Say I want to jump to question 2. When it tries to add one to my question variable I get 21. It seems that by saving q.text to my question variable, it gets recasted to a String. Has anybody else bumped into this problem.

Side note: I did fix this with parseInt. I am just curious why this happened in the first place, is type casting really not that strong?



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 02-10-2006, 02:03 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Type Casting
I have an input box where I want to put a number value that begins with zero. "016" I then put this value into an array and it drops the zero. I want the number value to be treated like a string. I have tried using the myText.toString() function, and the String(myText) constructor, but it still takes off the zero at the begining. does anyone have any ideas, or has anyone experienced this before?

Type Casting
Is there any way to convert String to Number? Flash doesn't convert it automaticly in my code. I used .valueOf but I didn't work.

Type Casting Problem
Hello gurus,
I have a problem:
while loading a number from a variable in a text file, into a script, i found that the number is not really a number but a string or a character. But i need it as a number to perform some operation. Can you please help me on how to convert that??

Type Casting To A Class Name
I'm trying to type cast an item in an array (inventoryList) to a Class, so I can addChild the movieClip to the stage. The items in the inventory 'carrotIcon and passportIcon' - I also have movieClips of the same name in the library with their own classes.

It works when I just change the line to 'addIconName = new carrotIcon()' for example. Maybe the answer is that I should use something else than 'Class' as the type cast. I've tried MovieClip to no avail.

var itemName:*;
var inventoryList:Array = new Array();
inventoryList.push("carrotIcon");
inventoryList.push("passportIcon");

for (var i:int = 0; i < (inventoryList.length); i++)
{
itemName = Class(inventoryList[i]); //this is the line I'm having problems.
addIconName = new itemName();
addChild(addIconName);
}

Thanks for looking!
Joe

Type Casting Problems
Quick Rundown of What I am doing so you can understand the logic is:

Building multipage Form In first Frame I hove no movies just initialized a bunch of Variables to store Data filled in from Forms on various Pages (frames 2 thru 7)
Page/Frame 2 is First Page which asks for Basic Details like Name Phone #s etc

I have a function that checks (when next page button is clicked) that checks Page form inputs are all filled correctly and if so updates the Variables (from frame 1) with the entered Data. Then on Return to the Page I prefill fields from the stored Variables.

Now the Problem:

For 4 different Phone numbers on the Page I have 3 inputs each (AreaCode, Prefix, Suffix)

When I go to store the entered values to 1 Variable each (Frame one/ Variable of type int/ to store the 10 digit number before sending to php serverside script) I concat the 3 input fields for each number and cast to int then on reenter page to preload the values again I cast the 10 digit int back to string and do a substr to divide them up and put them in the inputs as text.

However weird things happen Company Phone and Personal phone seem to usually work fine but Cell Phone and Fax get all muffed up the first time I renter (after leaving and returning they stay the same as first muffed up appearance)

Here is the portions relating to the Events please advise if you have any ideas how I can stop this behaviour. Thanks

Setting the Variable before leaving page

PHP Code:



cphone = int(CompanyPhoneAC.text + CompanyPhonePF.text + CompanyPhoneSF.text);
cfax= int(CompanyFaxAC.text + CompanyFaxPF.text + CompanyFaxSF.text);
pphone = int(PersPhoneAC.text + PersPhonePF.text + PersPhoneSF.text);
pcell = int(PersCellAC.text + PersCellPF.text + PersCellSF.text);




Setting the Inputs when Returning to Page

PHP Code:



var PersCAC:String = String(pcell);
PersCAC = PersCAC.substr(0,3);
if(PersCAC.length<3){
    PersCAC = "" ;}
PersCellAC.text  =  PersCAC;

var PersCPF:String = String(pcell);
PersCPF = PersCPF.substr(3,3);
if(PersCPF.length<3){
    PersCPF = "";}
PersCellPF.text  =  PersCPF;

var PersCSF:String = String(pcell);
PersCSF = PersCSF.substr(6,4);
if(PersCSF.length<4){
    PersCSF = "";}
PersCellSF.text  =  PersCSF;

var PersPAC:String = String(pphone);
PersPAC = PersPAC.substr(0,3);
if(PersPAC.length<3){
    PersPAC = "";}
PersPhoneAC.text  =  PersPAC;

var PersPPF:String = String(pphone);
PersPPF = PersPPF.substr(3,3);
if(PersPPF.length<3){
    PersPPF = "";}
PersPhonePF.text  =  PersPPF;

var PersPSF:String = String(pphone);
PersPSF = PersPSF.substr(6,4);
if(PersPSF.length<4){
    PersPSF = "";}
PersPhoneSF.text  =  PersPSF;

var CompanyPAC:String = String(cphone);
CompanyPAC = CompanyPAC.substr(0,3);
if(CompanyPAC.length<3){
    CompanyPAC = "";}
CompanyPhoneAC.text  =  CompanyPAC;

var CompanyPPF:String = String(cphone);
CompanyPPF = CompanyPPF.substr(3,3);
if(CompanyPPF.length<3){
    CompanyPPF = "";}
CompanyPhonePF.text  =  CompanyPPF;

var CompanyPSF:String = String(cphone);
CompanyPSF = CompanyPSF.substr(6,4);
if(CompanyPSF.length<4){
    CompanyPSF = "";}
CompanyPhoneSF.text  =  CompanyPSF;

var CompanyFAC:String = String(cfax);
CompanyFAC = CompanyFAC.substr(0,3);
if(CompanyFAC.length<3){
    CompanyFAC = "";}
CompanyFaxAC.text  =  CompanyFAC;

var CompanyFPF:String = String(cfax);
CompanyFPF = CompanyFPF.substr(3,3);
if(CompanyFPF.length<3){
    CompanyFPF = "";}
CompanyFaxPF.text  =  CompanyFPF;

var CompanyFSF:String = String(cfax);
CompanyFSF = CompanyFSF.substr(6,4);
if(CompanyFSF.length<4){
    CompanyFSF = "";}
CompanyFaxSF.text  =  CompanyFSF;

Dynamic Type Casting - Is It Possible?
Is there a way to do something like the following...?


Code:
var myClass:String = "blah";
var inst = new[myClass]();
I've invented the above syntax--though I'd be delighted if it turned out to work! For clarity, I would hope for something like the above code to be synonymous with the following:


Code:
var inst:blah = new blah();
...So is it possible to dynamically specify a class name when creating a new instance?

Type Casting Classes
Alright let's say I have a MovieClip in the library with the linkage set to TestClass and I have this code...

var string1:String = "Test";
var string2:String = "Class";

var testClass:* = new Class([string1 + string2])();
this.addChild(testClass);

so testClass should be an instance of TestClass, this works for me sometimes and sometimes it doesn't.

Does any one have any advice as a better way to do this, and what this tecnique is called ( root["string" + "1"])?

Thanks for all you guy's help!

Type Casting And Equality
TypeError: Error #1034: Type Coercion failed: cannot convert uk.co.andrewrea.brickwall::BrickWall@24b1191 to uk.co.andrewrea.brickwall.BrickWall.

Does anyone know why this would be. I create a variable of Type BrickWall and then assign it a variable of type BrickWall the event data of the loader i.e.


ActionScript Code:
wall = e.target.content.wall;

both wall and e.target.content.wall are of the same type of the same package, but seem to be handled as different types. Anyone know why this is?

Thanks,

Andrew

Dynamic Type Casting - Is It Possible?
Is there a way to dynamically typecast a new instance? Maybe something like the following...?


Code:
var myClass:String = "blah";
var inst = new[myClass]();
I've invented the above syntax--though I'd be delighted if it turned out to work! For clarity, I would hope for something like the above code to be synonymous with the following:


Code:
var inst:blah = new blah();
...So is it possible to dynamically specify a class name when creating a new instance?

AS2 - Casting An Object To A Different Type
Hi all,
I'm trying to convert a String to Slide (mx.screens.Slide). Everytime I'm getting null.


ActionScript Code:
var slide = "slide_11"
_root.presentation.gotoSlide(slide);


I need to do this but it doesn't work. I have a string because slide_11 was in a xml file.

Any idea?

Help: Casting String Gotten From Xml To A Number Type
Hi all,

I have a major problem, I have parsed the data from an xml doc to global vars in flash and need to use a few of them as numbers for things the position of "nodes" on the screen. However I can not cast the data stored as a var to a number or int value.

For example in the code below when the set Node button is pressed it traces the "Node's" current X value, then the value in the global var gotten from the xml, which contains the x position of where to place the Node.

Next it creates a new var of Number Type and assigns it the Number value of the string in global var.

It then traces the new value of SNtopLeftX and sets the x pos of the Node's movie clip to the value of SNtopLeftX

However the Node doesn't move and this is the output I get from the traces

Start Node is at x = -734.5
nod_topLeftX is 16
TopLeftX = 16
SN TopLeftX = NaN

I do not understand why I am getting NaN when the string of nod_topLefX is 16, any ides?
-------------------------------------------------------------------------------------------------------------------







Attach Code

butNodeSet.onRelease = function() {

trace ("Start Node is at x = " + mcStartNode._x);
trace ("nod_topLeftX is " + nod_topLeftX);

var SNtopLeftX:Number = Number(nod_TopLeftX);
trace ("StartNode TopLeftX = " + SNtopLeftX);
mcStartNode._x = SNtopLeftX;
}

Help: Casting String Gotten From Xml To A Number Type
Hi all,

I have a major problem, I have parsed the data from an xml doc to global vars in flash and need to use a few of them as numbers for things the position of "nodes" on the screen. However I can not cast the data stored as a var to a number or int value.

For example in the code below when the set Node button is pressed it traces the "Node's" current X value, then the value in the global var gotten from the xml, which contains the x position of where to place the Node.

Next it creates a new var of Number Type and assigns it the Number value of the string in global var.

It then traces the new value of SNtopLeftX and sets the x pos of the Node's movie clip to the value of SNtopLeftX

However the Node doesn't move and this is the output I get from the traces

Start Node is at x = -734.5
nod_topLeftX is 16
TopLeftX = 16
SN TopLeftX = NaN

I do not understand why I am getting NaN when the string of nod_topLefX is 16, any ideas?


------------------------------------------------------------------------------------------------------------------- This is my Code
butNodeSet.onRelease = function() {

trace ("Start Node is at x = " + mcStartNode._x);
trace ("nod_topLeftX is " + nod_topLeftX);

var SNtopLeftX:Number = Number(nod_TopLeftX);
trace ("StartNode TopLeftX = " + SNtopLeftX);
mcStartNode._x = SNtopLeftX;
}

Instantiation/Type Casting Problem With GetChildAt
Alrighty so I'm kinda new with actionscript 3.0 and have been having a problem with getChildAt. I'm working on creating a dynamic menu have have found that when I addChildAt using a for loop it adds all the childs properly however when I go to use getChildAt on the MovieClip that I have created using "var newMC:MovieClip = mc_container.getChildAt(x)" it returns a problem saying "Implicit coercion of a value with static type flash.display:DisplayObject to a possible unrelated type flash.display:MovieClip"
Anyways I'm trying to get it to work however I found a work around that I'm not sure why works where I just do "var newMC = mc_container.getChildAt(x)" and that will let me access all of the variables and stuff however when I do a trace on the newMC it says type undefined... Anyways some help would be awsome, and heres my code btw, should be pretty easy to read.


import flash.display.MovieClip;
import flash.display.Shape;

var news_content_num = 1;
var news_padding = 0;
var news_padding_distance = 10;

var news_ymin = 0;

var news_full_width = 289;
var news_full_height = 154;

var news_compact_height = 61;

var news_shading_xval = 290;
var news_shading_yval = 255;

var news_bordersize = 1;
var news_shading_offset = 1;

var news_content:MovieClip = new MovieClip();

function drawBorder():Shape {
var border:Shape = new Shape();
border.name = "border_"+[x];

//Add the Left Line and then Top Line
border.graphics.lineStyle(news_bordersize, 0xCCCCCC, 1);
border.graphics.moveTo(0, news_ymin + news_full_height);
border.graphics.lineTo(0, news_ymin);
border.graphics.lineTo(news_full_width, news_ymin);

//Add the Right Side Drop Shadow
border.graphics.lineStyle(news_bordersize, 0X999999);
border.graphics.moveTo(news_full_width+1, news_ymin+2);
border.graphics.lineTo(news_full_width+1, news_full_height+news_shading_offset);

//Add the Bottom Side Drop Shadow
border.graphics.lineTo(2, news_full_height+news_shading_offset);
//this.addChild(border);

//Add the Right Side Border
border.graphics.lineStyle(news_bordersize, 0X000000);
border.graphics.moveTo(news_full_width,news_ymin);
border.graphics.lineTo(news_full_width, news_full_height);
//this.addChild(border);

//Add The Bottom Side Border
border.graphics.lineTo(0, news_full_height);

return border;
}

function drawNews_fullSize(x:Number) {
var mc = new MovieClip();
mc.name = "news_"+[x];
mc.y = news_padding;
mc.addChild(drawBorder());
news_content.addChildAt(mc, x);
}

function set_padding()
{
news_padding = news_padding + news_full_height + news_padding_distance;
}

for(x = 0; x < 4; x++){
drawNews_fullSize(x);
set_padding();
}

this.addChild(news_content);

//What I want it to run as...
//var news:MovieClip = news_content.getChildAt(0);
//What currently works...
//var news = news_content.getChildAt(0);

AS 2 <strong>FullScreen Flash... Problem With MovieClip Position</strong>
Hey,

I'm currently programming a site available to see at:

http://biddleinc.ca/empiregrill/

The problem i have is that when I load in external .swf files which are bigger than the main centered movieClip (centeredContent_mc)... if you resize the browser it will bump the center section to a new position because it's size has changed. You can see this in the "Take a tour" section.

This is the code im using:


Quote:




Stage.scaleMode = "noScale";
Stage.align = "TL";

var stageListener: Object = new Object();

stageListener.onResize = positionContent;

Stage.addListener(stageListener);


function positionContent():Void
{
centeredContent_mc._x = Stage.width/2 - centeredContent_mc._width/2;
centeredContent_mc._y = Stage.height/2 - centeredContent_mc._height/2;


if ( Stage.height/Stage.width > background_mc._height / background_mc._width )
{
var ratio = background_mc._width/background_mc._height;

if ( Stage.height > 400 )
{
background_mc._height = Stage.height;
background_mc._width = Stage.height*ratio;
}
}
else
{
var ratio = background_mc._height/background_mc._width;

if ( Stage.width > 400 )
{
background_mc._width = Stage.width;
background_mc._height = Stage.width*ratio;
}
}
}

positionContent();






My question is: Is there any way to specify the new movieClip and keep if from changing the size of the mc it's being loaded into?

I would GREATLY appreciate any comments!!!!

Fancy Box Type Moving Graphic Type Cool Efect But Im To Dumb Type Thingy
i am tring to make a box thinky simaler to the one on www.starvingeyes.com but cant even work out how to start it. is there anyone who can point me in the right direction or to a tutorial ?

the box has a graphic inside a grided box the sections of the graphic fade in and out as the mouse goes over them and displays random sections when the user is not moving the mouse over the box

i did find java tutorials for this effect but would much preffer it to come from flash as java is a bugger to get working on some machines

Any way thanks in advance for any help

Steven Green one_mad_punk@yahoo.co.uk

Strong Tag?
What is the best way to get Flash to recognize tags like <strong> <em>...etc.? I built a WYSIWYG editor into my admin area, but it's automatically converting Bold, Italic (and hard telling whatelse) into tags that Flash apparently can't understand.

Strong Bad E-Mail
Hey, I'm new and I was just thinking about something. At www.homestarrunner.com, for the sbemails, how do they animate the text that easily? Do they need to animate every single letter seperatly?

Anyways, just wondering.

I Need Strong Critique, Please
http://www.melnicomm.com/blog/images/crazy_flash.gif



I want to go to my bed! I so miss my bed! ... My wife for example, wake up in two hours... She sleeps 9-10 hours -- me 3-4

any way, check please my new layout - now I created many new things:-)

melnicomm.com/lab

Thanks all !!!

Buona notte:-)

Q: What About Strong Typing In AS3?
Hi all, I was wondering about this a while back. Does AS3 make any changes pertaining to the typing of variables? I know next to nothing about how AS3 will work, but I'm wondering if it's gonna be easier to type a lot of vars with it.

For example, now I have to do:
Code:

var eggs:Number = 2,
    flour:Number = 300,
    milk:Number = 50;

Is this going to be easier in AS3? (And prettier?) :?

Maths Not My Strong Point
Okay..I have a mc which has another mc inside it reduced at 25% i then have another mc inside that one again reduced by 25% and so on and so one.

My aim is to scale the main mc by 400% each time to view the next mc inside it...very similiar to websites done before such as sofake.com...its basically a zoom menu system. The basic scipt is as follows:

onClipEvent (enterFrame) {
if (_root.contents._xscale>_global.scale) {
_root.contents._xscale -= (_root.contents._xscale-_global.scale)/5;
} else {
_root.contents._xscale += (_global.scale-_root.contents._xscale)/5;
}
}

then on each button i have:

(btn 1) _global.scale = 100;
(btn 2) _global.scale = 400;
(btn 3) _global.scale = 1600;
(btn 4) _global.scale = 6400;

it all works fine apart from the speed it travels between each scaled mc. if you travel between say btn1 and btn2 it works fine and if you travel back from btn 4 to btn 1 that works fine to. but if you travel from say btn1 to btn 4 it seems to zoom straight into btn 3 then ease properly into btn4.

I basically want it to travel at a nice ease through all the mc until it reaches its scaled mc.

I hope this makes sense...have a look at sofake.com to understand or i may be able to attach a .fla

please help me...i wasn't that good at maths at school...art was for me

Antialias Is Too Strong, How Do I Calm It Down
Okay, here is the site

http://matthewbernardo.com/flash/

If you click on the portfolio section, each page has a small description. My problem is, however, that the text comes up looking really bad, as if the antialiasing worked it over a bit too much. I tried other settings, but antialias for animation was too soft and no aliasing was terrible (I would switch to device fonts, but not everyone has the font I am using). Also the custom anti alias doesnt seem to do anything. How do I get the text to be crisp, but not burnt?

Thanks in advance.

So How Strong Is Flash These Days
Hi all,

What's your oppinion on the strength of Flash these days, i mean compared to .net/java/ruby/haxe/php etc... i mean it's the only decent way we can animate someting cool on the web, 97,7% of all desktops has the flash player plugin installed) and it has major programming capabilities.

But i can read and write files with flash, even write a complete engine if i would like to, and even animate my website wherever i need to, this is not even close to posible on .net or php, java could do animation but isn't that stable imo.

Not even speaking on the new technologies like flex, but that's where my technique knowledge stops, can't know everything these day's

So what's your thought on this...
Let us know..

Strong Typing Variables
Hey guys.

Does anyone know if strong typing variables in Flash does in fact increase performance? I've read and heard both versions.

Also, is there a way to strong type a variable that you set this way:


ActionScript Code:
var newClip:MovieClip = this.createEmptyMovieClip("newClip", 100);// this will return an error during compile?newClip.myNewVar:Number = 100;


Cheers!

Strong Push In The Right Direction
Goal:
To create movieclips in a for loop. Each movieclip will contain 2 dynamic textfields, and one movieclip which will pull in an image.

Issues:
- Making the textfield the child of the movieclip, thus assigning a value to that textfield.
- Doing this with all around best practices. Other than just getting it working, I want to learn best practices on the way.

Extra Info if you want it:
The content will be pulled in via swfObject from an html file, which will reference a div by its ID and pull in the information. It is kinda like referencing an xml file.

AS2 isn't my forte, but I just happen to be the guy who understands AS2 in any way. Websites, tutorials, wise words are greatly appreciated.

Strong Sharp Glows.
Hello Everyone,

Please go here:

http://www.realityslip.com/plur2k/hybrid.htm

when you roll over certain text items, (like the change region button). They have really nice glows to their text rollovers.

How are their glows coming out so crisp and clear. I know they did this before flash 8. I know this might be something simple....

Thanks for any help...

As2 Replace <strong> To <b> Function
Hello. I have an AS3 class I found some time ago. I do not know where I found it on the net at this point and wish i could give the developer credit.

I need to use it as a function in AS2 (or another way someone suggests). Below is what is not working for me. I was thinking this must be a popular thing to do but can't find an example. I hope to get this working and believe many people will find it useful like in a CMS using TincyMCE. I realize someone might prefer to just make TinyMCE output <strong> instead of <b> or convert with php but I believe this will be more powerful . I can bring in xml from any source. What's wrong here (besides s-u-c-e-s-s, ha):


Code:
// xml object / ignorewhite
xml = new XML();
xml.ignoreWhite = true;
//load object for parsing
xml.onLoad = function(sucess) {
if (sucess) {
theText = xml.childNodes[0];
format(theText);
var theTitle:String = xml.firstChild.attributes.pageTitle;
trace(theTitle);
trace(theText);


myContent.texto.page.htmlText = "<body>"+theText+"</body>";
myContent.title_mc.myTitle.text = theTitle;
trace(myContent.title_mc.myTitle.text);

function replace(sValue:String, sToReplace:String, sWith:String):String {
return sValue.split(sToReplace).join(sWith);
}
function format(sValue:String):String {
//add your text that needs replacing here
//sValue = replace(sValue, <text that needs replacing>,<text that needs to be inserted>)
sValue = replace(sValue, "<strong>", "<b>");
sValue = replace(sValue, "<STRONG>", "<b>");
sValue = replace(sValue, "</strong>", "</b>");
sValue = replace(sValue, "</STRONG>", "</b>");

sValue = replace(sValue, "<em>", "<i>");
sValue = replace(sValue, "<EM>", "<i>");
sValue = replace(sValue, "</em>", "</i>");
sValue = replace(sValue, "</EM>", "</i>");

return sValue;
}


My xml file is simply 1 tag of text and the title is an attribute. Looking at my output, the <strong> tags remain. Can i not directly apply it to theText or something?

Strong Typing A Function?
I've made the full transition to AS2 in the last months, and I'm curious wether I should strict declare the functions as well or not, like this:


ActionScript Code:
var myFunction:Function = function(param1:Function):Function{
return param1;
}

I mean, I havent seen that in any script so far, is that necessary or even right to do?

AS2.0 Strong Typing And Global Variables
In order to use strong typing in Flash MX04 you have to use:

var myVar:String;

My question is. How can you use strong typing with global variables. You cannot do this:

var _global.myVar:String;

or this:

_global.myVar:String;

so how is it done? I like to make all my timeline variables _global in scope so that I don't have to keep using _parent._parent etc etc all the time and all globally defined values can be reached no matter where you are by just adding _global. to the variable name.

Please enlighten me!

Thanks!

Strong Data Typing Questions
I'm trying to use strong data typing and abosolute paths to make my code as clean as possible I've used what i know below but an wondering if there is more that i need to do also i need a website or resource that lists all the strong data types....the only ones i know are String,Number, and Object are there more where do i find information about strong data typing and making my code clean? I'd appriciate any insight you have on this subject.

Code:

output_txt.htmlText = "";
function output(arr){
var len:Number = arr.length;
for( i:Number=0; i<len; i++){
output_txt.htmlText += "Element " + i + ": " + arr[i] + "<br>";
}
output_txt.htmlText += "<br>";
}


var help:Array = new Array();
help[0]= "Help!";
help[1] = "The Night Before";
help[2] = "You've Got to Hide Your Love Away";
help[3] = "I Need You";
help[4] = "Another Girl";
help[5] = "You're Going to Lose That Girl";
help[6] = "Ticket to Ride";
help[7] = "Act Naturally";
help[8] = "It's Only Love";
help[9] = "You Like Me Too Much";
help[10] = "Tell Me What You See";
help[11] = "I've Just Seen A Face";
help[12] = "Yesterday";
help[13] = "Dizzy Miss Lizzie";
output(help);

Very Strong ActionScript Obfuscation Tool
hi all
i have found a new actionscript obfuscation tool
i have test it on all powerful decompilers.
it is confuse all of them
but i haven't test it on ASV latest version yet.
i have tested it on ASV 5.01 and ASV has Confused
but i am looking for some one to test my protected swf against ASV 6
thx
btw : i think it is not against the forum rules

Flash Project: Security Strong Enough?
Hi,

I recently made a flash AS2 application which loads an external config.XML file. This xml file contains the URL's needed for AMFPHP (php files) and the URL for a Flash Media Server 2.

I use this xml file in favor of hardcoding all the URL's in the flash application so when it's decompiled they get nothing. The only thing hardcoded is the relative URL to the config.XML file.

Now, if I deny directory access for the xml file (with the control panel of the internet host) will this be enough so the public can't see these files (php en xml files) and will it make everything secure?

If you think not, how can I make this more secure?

-- krikke

3DMLW Technology As An Strong Alternative To Fla
Hi Expertz,
i found a new platform which can be replaced with Flash 10 Platform for Designing cool stunning applications...Can anybody let me know if they have tested it??

I saw that its open-source and free to use, so i just wanted to let you all know about it and test it { if you haven't done yet } and let me too know if it should be used as an alternative to Flash 8 or i should stick with current Flash versions only??

Mods, I request you to not delete this as i am not advertising anything here, i am just informing all other users about this new platform..Everybody is invited to visit the site here at :: www.3dmlw.com .

Have a nice day all,
regards,
Core2Quad :: A decent technology

Strong Typing (not The Usual 'why' Thread)
So i did see the post about typing in the sticky above, but my question isnt as to why i should use it. I had heard that with as3 it was Required that you give a type to all your variables or it wouldn't compile. I have found this to be false which gave rise to my question. Did i just mishear it altogether or is there perhaps an option that can be switched so that the typing is required? This was born out or curiosity than anything else, any insight would be appreciated. thanks.

How To Strong-typing Object Property?
var obj :Object = new Object();
obj.name = "James";

trace(typeof(obj.name)); // object

How to force the object type to string?
It cause me problem when my function only take String input

function whatever(name :String):Void
{
....
}

Would Someone Mx.transitions.easing.Strong.easeOut Explain For Me?
what is this mysterious line?

im done with mouserecord (talking about my physical fitness)

mx.transitions.easing.Strong.easeOut make me into nebula, here is a screenshot from what part i mean (didn't see it working yet)



and the hole program, thanks

Strong Typing XML Data In Settings Class
Hi,

I have a Settings class which loads an XML file. The XML file contains nodes with 3 attributes - type, value and key. For example:


Code:
<myNode type="String" key="copyright_txt" value="This is copyright of somebody somwehere" />
In my Settings class I have a public function:
Code:
getSetting(key:String):Object{
//Match key and return value;
}
It runs through the XML and returns the value of the node with the matching key.

My problem is that the returned item is always Typed as Object. Is there any way I can Strongtype the returned value without having to have separate getter functions for separate types?

Thanks

Creating A Strong Typed Variable Inside Of A MC
If you can dynamically create a movie clip on the fly and can set a variable simply by typeing 'myMc.newVarName = 22', how can you create a strong typed variable inside of that movie clip?

3DMLW Technology As An Strong Alternative To Flash 10
Hi Expertz,
i found a new platform which can be replaced with Flash 10 Platform for Designing cool stunning applications...Can anybody let me know if they have tested it??
I saw that its open-source and free to use, so i just wanted to let you all know about it and test it { if you haven't done yet } and let me too know if it should be used as an alternative to Flash 8 or i should stick with current Flash versions only??
Mods, I request you to not delete this as i am not advertising anything here, i am just informing all other users about this new platform..Everybody is invited to visit the site here at :: www.3dmlw.com .

Have a nice day all,
regards,
Core2Quad :: A decent technology

3DMLW Technology As An Strong Alternative To Flash 10
Hi Expertz,
i found a new platform which can be replaced with Flash 10 Platform for Designing cool stunning applications...Can anybody let me know if they have tested it??

I saw that its open-source and free to use, so i just wanted to let you all know about it and test it { if you haven't done yet } and let me too know if it should be used as an alternative to Flash 8 or i should stick with current Flash versions only??

Mods, I request you to not delete this as i am not advertising anything here, i am just informing all other users about this new platform..Everybody is invited to visit the site here at :: www.3dmlw.com .

Have a nice day all,
regards,
Core2Quad :: A decent technology

Doesn't Make Sense: Var Strong Typed As Color
I've declared a variable as such


Code:
private var baseColor:Color;

used an init function to set it:

Code:
public function initElasticNav(navWidth, navHeight, navArray, baseColor){
this.navWidth = navWidth;
this.navHeight = navHeight;
this.navArray = navArray;
this.baseColor = baseColor;
createNavLevel(this, navArray, navWidth);
}
and then tried to change it later on down the line

Code:
baseColor = 0x000000;
and get this error
Type mismatch in assignment statement: found Number where Color is required.

I can't reset it as a hex value, or a number that falls in the hex range.

I can declare the var as a Number and it works fine, but then what's the point of being able to strictly declare a var as a Color?

<strong> Tags Forcing Line-breaks In Flash
So I have created a textField that has a CSS style applied to it using embedded fonts. I have in-line <a href= > links that display fine - and even <strong> works - but, it creates a line-break after it.

I thought maybe the closing tag had a line-break character ('
') after it, so i tried replacing it if it existed:

ActionScript Code:
text.split('</strong>
').join('</strong>');

but no success.

I have a feeling this might be an actual Flash flaw. Does anyone know?

Trigger Code Hinting On Strict (or Strong) Data Types
Hey!

I've seen Lee get back the code hints whenever his is typing some code on the timeline. For instance

var bmp:BitmapData = new BitmapData(foo._width, .... get back code hints here!, ...... );

What is the command/key stroke to get those back? I tried hitting control-spacebar like the livedocs say, but that only works if no params have been entered.

Any help?
cheers.
:)

AS3: Casting
What is the difference between the following two statements?


ActionScript Code:
oBj1 = XML(oBj2);

and


ActionScript Code:
oBj1 = oBj2 as XML;

TIA, Eugene

Casting
Hi. Why does the attached lines return true, all three of them?

I understand the first returning true, I could even understand the second (strictly from the documentation it's ok to return true, but I think the "as" word is misleading), but I definitely don't understand why the third one is true.

Could some one explain me the exact semantics of those thing?

Thanks,
FaQ







Attach Code

var a:Sprite = new Sprite();

trace(a is Sprite, " = a is Sprite");
trace((a as DisplayObject) is Sprite, " = (a as DisplayObject) is Sprite");
trace(DisplayObject(a) is Sprite, " = DisplayObject(a) is Sprite");

Web Casting And Forums?
Hi folks, I need a pointer in the right direction here!
I have to setup a live webcam and a stills webcam on 10min refresh, aslo I need to make a forum page all in flash mx2004, can anyone point me in the direction of some good tutorials that I can just dive into?

Any help greatly appriciated.

Cheers.

Casting To Integer - What's Going On?
Look at this piece of code:

---------------------
alint = "0060";
trace (int(alint));
---------------------

this gives the value 48.

-48!?!? Where does that come from?

Help appreciated!

Casting An Array To An Int
I have this trace statement that reads out a array of an sql database-
trace(re.result._items[row][name]);

It prints this

2
8 *
3
1
5 *
2
0
5 *
1

I am trying to pull out the numbers with a * and make them seperate int's. Whats the best way to do this? Thanks in advance!

Casting To Integer?
Hi,

I am new to actionscript .
How do I cut off the decimal part of a Number to get only an integer.

I want to display % complete of an upload, and I want for example
75.43% to read 75%

So there is no integer type in ActionScript 2? only Number?
Is there some way to cast the darn thing ?
Or how do i do it?

-thanks

Instanceof And Casting; Anyone?
I'm setting up a nice event-handling class for taking care of the WebServiceConnector. I'm trying to do a clean cast of the result object, so I can get it back into type safety before handing it off to whatever class asked for it.

This (and variations thereof) is what I've been trying for a while now:


Code:
private function resultListener(res:Object)
{
if(res.target.results instanceof Boolean)
{
var return:Boolean = Boolean(res.target.results);
}
else if(res.target.results instanceof String)
{
var return:String = String(res.target.results);
}
else if(res.target.results instanceof Number)
{
var return:Number = Number(res.target.results);
}
else if(res.target.results instanceof Array)
{
var return:Array = Array(res.target.results);
}
else if(res.target.results instanceof Object) //(should) always true
{
var return:Object = Object(res.target.results);
}
}
None of these if-clauses are ever true. I would suspect - at the very least - that "instanceof Object" would be a catch-all, but it isn't. So... what type is results?

Do you have any idea as to how I can create this function - casting the result to a known AS-type?

Copyright © 2005-08 www.BigResource.com, All rights reserved