Clearing XML Caching in Flash
- June 26th, 2010
- Write comment
the simplest way is to load it that way
xml.load("xmlFile.xml?"+Math.random());
since it will think that the file is new file each time…kinda not bad
Archive for the ‘Flash’ Category
the simplest way is to load it that way
xml.load("xmlFile.xml?"+Math.random());
since it will think that the file is new file each time…kinda not bad
Here is a small tutorial of all you need for text feild inside a movie clip.
First we should create our movie clip
createEmptyMovieClip(“fudge”,i);
Now Lets create our text feild inside of the movieClip fudge
with (“fudge”) {
createTextField(“my_title”,getNextHighestDepth(),0,0,350,20);
}
Nice now we have a text feild that is called my_title and that is inside fudge we can even control several things of that text feild, like height, html, border, multiline and so on here if we continue with the with scope again
with (“fudge”) {
createTextField(“my_title”,getNextHighestDepth(),0,0,350,20);
my_title.autoSize = “left”;
my_title.wordWrap = true;
my_title.multiline = true;
my_title.border = false;
my_title.html = false;
my_title.text =” This should be a long text to test the auto height of the text feild we are creating and check if its working well”;}
Since we put autoSize to left and multiline and autowrap to true then the textFeild will grow by height.
Now Finally, We also can add text Format to color our text and choose the fontĀ size here is what we do
var title_format:TextFormat = new TextFormat();
title_format.color = 0xEBCF4E;
title_format.font = “Tahoma”;
title_format.size = 11;
title_format.bold = true;
But also we shouldnt forget to style the thing we’ve started so here
my_title.setTextFormat(title_format);
Now this shouldnt go with the text thing at all but I always prefer to adjust the height of the movieClip to the height of Text incase I want to use the movieClip height later so here how to do it
with (“fudge”) {
_height = my_title._height;
}
So now if I want to add any movie beneath Fudge all what I have to do is
myNewMovie._y= fudge._height+fudge._y;
Thats all folks. hope this was helpful enough for you ^^”
Here is the way
supposing we have XML that have this structure
<?xml version=”1.0″ encoding=”UTF-8″?>
<products>
<item Title= ” Home ” Desciption=”" />
</products>
///set up this default, not worth explaining
XML.prototype.ignoreWhite = true;
///Create a new empty XML Object
var myXML:XML = new XML();///load in the xml file
myXML.load(“products.xml”);
//if the XML file has successfully loaded in, then this function is run through
myXML.onLoad = function(success) {
if (success) {
i=0;
//new array for the total number of childNodes
menuArray = new Array();
menuArray = this.firstChild.childNodes;
while (i<menuArray.length) {
trace(this.firstChild.childNodes[i].attributes.Title);
i++;
}
}
};
The best way to do that in actionscript 2 is to import the transition library and then check if the movie loaded and create the alpha effect
import mx.transitions.Tween;
import mx.transitions.easing.*;
loadMovie(“home.swf”, movie_loader);
this.onEnterFrame = function() {
if (movie_loader.getBytesLoaded()>=movie_loader.getBytesTotal() && movie_loader.getBytesLoaded()>1) {
Tween1 = new Tween(movie_loader, “_alpha”, Strong.easeIn, 0, 100, 1, true);
delete this.onEnterFrame;
}
};
Stop();
Short and clean
var HideMenu:ContextMenu = new ContextMenu ();
HideMenu.hideBuiltInItems();
this.menu = HideMenu;
I was working with login script using the usual code I used to use for always
loadVariableNum(“test.php”,0,”POST”);
kinda nice but wait wait wait, what is this doing? loading all the root variables and spreading php variables on root randomly, HELL that is a real mess? it even didnt work in some cases (like my case today with my XML Flash file)
but yes as usual alot of search and alot of do. I got it to work perfectly with this very very clean code
Send and Load (To send specific variables to PHP) and Get Specific one back.
so here it is
on (release, keyPress “
“) {
if (_root.user != “” && _root.pass != “”) {
_root.text=”Connecting..”;
//result_lv to get variables from php
var result_lv:LoadVars = new LoadVars();
//set_lv to post variables to php
var set_lv:LoadVars = new LoadVars();
set_lv.user = _level0.user;
set_lv.pass = _level0.pass;
set_lv.sendAndLoad(“newlogin.php”,result_lv,”POST”);
result_lv.onLoad = function(success:Boolean) {
if (success) {
if (result_lv.checklog == 1) {
_root.text=”Congrat you are logged”;
}
else
{
_root.text=”Sorry no such user name or password”;
}} else {
_root.text=”Could Not Connect”;}
};
}
}
I know this is flash thing but if you still curious about the php part then here it is
$user=$_POST['user'];
$pass=$_POST['pass'];
if ($user && $pass){
mysql_connect(“localhost”,”root”,”");
mysql_select_db(“database”);$query = “SELECT * FROM users WHERE username = ‘$user’ AND password = md5(‘$pass’)”;
$result = mysql_query( $query ) ;$num = mysql_num_rows( $result );
if ($num == 1){
print “status=You’re in&checklog=1″;
} else {
print “status=Sorry!&checklog=2″;
}
}
Yes Finally. Writing Arabic in Flash and using XML!! Weheeeeeee.
I’m excited about it because this was my concern for years and years and yesterday taraaa! I found the extension that worked perfectly!
The main feature of this extension is the ability to embed fonts and the ability to have multiple lines.
its made for Flash 8 and works for ActionScript2. I have flash CS3 and it worked fine too (>.>; since I still use ActionScript *coughs coughts*) anyways the extension is called Flaraby3 there is a lite version for free and a paid version for 30$.
So far the Lite version works perfectly for me and you can download it and see the video tutorial from here.
http://www.arabicode.com/flaraby/flash_arabic_support.php#license
Hope this will help you.
Good Luck!
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Jun | ||||||
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |