cookie与sharedObject之间的比较以及flex利用cookie
在php里创建cookie只需要:
setcookie ($user,$value,time()+2*60); //cookie写入客户端
删除cookie也只需要再次设置一次 cookie将 时间变成过去的就可以了 setcookie ($user,$value,time()-20); //
在flex里创建sharedObject
var so:sharedObject= sharedObject.getLocal("sample"); //得到sharedObject的引用,没有则创建Sharedobject ,这部可以理解为加载SO
//我们像在cookie里一样给其赋值:
so.data.user="dreamnight"// 写入user属性
//由于SharedObject是存储在硬盘上的文件我需要刷新缓冲区,将其写入文件
由于cookie可以再flex/flash和其他的html以及x像php这样的语言中使用 而SO只能在flex/flash中使用
为了更好的利用他们 我们以cookie作为中间量:
so.flush();
与cookie的删除对比
注意SharedObject本身是一个文件 也就是个空壳 只有填充数据后才能称为真正的SO
例如
var so:sharedObject= sharedObject.getLocal("sample");
if(so.data.size()==){
trace("so对象不存在");//这里并没有实际意义上的cookie(SO) 相当于没有SO.一样,只有填充数据了才叫SO
}
由上可知,当我们删除SO时,不需要删除SO文件 只需要删除里面的数据即可:
So.data.clear();
注意clear后 只是将so.data.user的值删掉了 但是 这个uer属性还是存在的!只是user undefined 下次我们创建SO时可以再次写一遍,即再次 So.data.user=“某个值”
虽然SO很好但是 我还是喜欢cookie些 下面是flash利用cookie的例子:
php端:
<?php
if(isset($_POST['act']) && $_POST['act'] == 'getcookie') // act 属性是flash端通过URLLoader(或者httpService)发送过来的
{
if(isset($_COOKIE['sample']))
{
print "resp=" . $_COOKIE[$_POST['cookieName']];// resp 最后返回给flash端
}
else
{
print "resp=" . "cookie_not_found";
}
}
?>
flash端:
var phpFile:String = "http://localhost/flashphp/examples/ch%2006/cookies/loadCookie.php";
var variables:URLVariables = new URLVariables();
variables.act = 'getcookie';
variables.cookieName = 'sample';
var urlRequest:URLRequest = new URLRequest(phpFile);
urlRequest.method = URLRe
相关文档:
CategoryAxis有一个叫做labelFunction的属性,这个属性的定义:指定一个函数,用于定义为CategoryAxis的dataProvider中的各个项目生成的标签。
所以修改的原理:可以利用labelFunction得到每个Label,然后再对其进行修改。
片段代码:
<mx:horizontalAxis>
<mx:CategoryAxis id="ca"
&nbs ......
<?xml version="1.0"?>
<!-- charts/PredefinedAxisStyles.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<!--[CDATA[
//导入相关包
import mx.collections.ArrayCollection;
import mx.charts.*;
import mx.charts.ser ......
一 网站
1 在线图片处理工具网站http://www.flauntr.com/
。
2 官方网站的例子 http://examples.adobe.com/flex3/componentexplorer/explorer.html
3 官方AS3学习资料网站 http://www.adobe.com/devnet/actionscript/
4 这儿推荐一个网址,不仅可以对其它的数据类型进行学习,还有基础的语法,非常不错:
  ......
官网信息:(API:http://flexlib.googlecode.com/svn/trunk/docs/index.html)
HowToContribute
How you can contribute code to FlexLib
IntroductionLicenseBefore you submit codeFlexBuilderProject page to learn how to check out the project into Flex Builder. Read HowToBuild to learn how to compile ......
先用现成的组件玩一下,一会再去看看组件源码研究一下。
http://code.google.com/p/flex-iframe/
下载了flexiframe.swc,引入工程。
flex代码
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
......