Guys, if you attach the UI Scrollbar component with Dynamic textbox in Flash where the text will be populated from XML or a Text file, the scrollbar won't work and resize automatically.
When I was working on one of my flash component where the data was being populated from XML, I assumed that the scrollbar will automatically adjust according to the amount of the data but nothing really happened.
So to make the scrollbar work after you have populated your dynamic textbox with the content you can type the following action to make the UIScrollbar work -
mc_scroll.maxScrollPosition = details.textHeight;
"mc_scroll" is the instance name of my scrollbar attached with the dynamic textbox & "details" is the name of my dynamic text box.
Monday, March 16, 2009
Friday, March 13, 2009
Playing multiple videos Dynamically
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
Create a connection object
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
Create a NetStream object and pass the NetConnection object
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.client = new Object();
One connection object can be used for more than one video stream.
myVideo.attachNetStream(stream_ns);
stream_ns.play("video.flv");
myVideo is the name of my video object placed on the stage & video.flv is the video file which needs to be played. Now if you want to play another video you have to create a new NetStream object for each video otherwise it will not work. I spent 4 hours just to figure this out & kept trying different techniques to make my 4 different videos work with the same NetStream object. But unfortunately it is not possible.
So guys the trick is to create different NetStream object for each video & have fun.
Happy Streaming!!!
import flash.net.NetConnection;
import flash.net.NetStream;
Create a connection object
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
Create a NetStream object and pass the NetConnection object
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.client = new Object();
One connection object can be used for more than one video stream.
myVideo.attachNetStream(stream_ns);
stream_ns.play("video.flv");
myVideo is the name of my video object placed on the stage & video.flv is the video file which needs to be played. Now if you want to play another video you have to create a new NetStream object for each video otherwise it will not work. I spent 4 hours just to figure this out & kept trying different techniques to make my 4 different videos work with the same NetStream object. But unfortunately it is not possible.
So guys the trick is to create different NetStream object for each video & have fun.
Happy Streaming!!!
Wednesday, March 11, 2009
Flash XML parsing including HTML tags in the XML
If you want to parse the HTML tags within your XML, the XML document should look like below -

And in the Flash scripting if you have a Dynamic Textbox named dynTxt the code will be as follows -
dynTxt.htmlText = Variable holding your text data
Following are the tags supported by Flash while parsing XML-

And in the Flash scripting if you have a Dynamic Textbox named dynTxt the code will be as follows -
dynTxt.htmlText = Variable holding your text data
Following are the tags supported by Flash while parsing XML-

Mask on Dynamic Textbox
I encountered a strange problem in Flash when I tried masking a dynamic text box and it didn't work. After doing lots of research on the internet I found out that if you mask a dynamic text box the text won't appear.
So to save time for the people trying to mask the dynamic text box here is the tip, click your text box in the properties panel click the Embed button and embed the fonts and your text will start appearing again.
So to save time for the people trying to mask the dynamic text box here is the tip, click your text box in the properties panel click the Embed button and embed the fonts and your text will start appearing again.
Thursday, February 26, 2009
Online Rugby Game
I have recently finished an online Rugby Game which can be accessed at - www.303.com.au/projects/rugby/rugby.html
Hope you like it!
Hope you like it!
ReferenceError: Error #1065
I could not post any entries in the last few months because of my busy schedule & finally I got a chance to post this problem with AS3.0 while parsing XML.
While parsing XML I came through this error -
ReferenceError: Error #1065
which is kind of vague error, I could not find anything anything related to my code even after searching for hours. Finally I decided to jump into my XML & keep only few entries to test & it worked.
After sweating for hours I found the error in the XML because one of the node was missing. So guys if you are getting this error while parsing XML, jump into the XML and check your structure.
While parsing XML I came through this error -
ReferenceError: Error #1065
which is kind of vague error, I could not find anything anything related to my code even after searching for hours. Finally I decided to jump into my XML & keep only few entries to test & it worked.
After sweating for hours I found the error in the XML because one of the node was missing. So guys if you are getting this error while parsing XML, jump into the XML and check your structure.
Labels:
ReferenceError: Error #1065
Monday, September 22, 2008
Tweening with AS3
Fellow Flash Devs,
I have finally started playing with AS3 & tried doing some experimentation with Tween class.
It's as simple as before except the classes which needs to be imported are different. So for AS3 we will import fl.transitions.Tween & fl.transitions.easing.*
Please use the code below to simply animate a box kept on the stage using Tween class-
import fl.transitions.Tween;
import fl.transitions.easing.*;
b1.buttonMode = true;
b1.addEventListener(MouseEvent.CLICK, btnclick);
function btnclick(event:MouseEvent)
{
new Tween(b1,"x",Regular.easeOut, b1.x, b1.x+50,1, true);
}
I have finally started playing with AS3 & tried doing some experimentation with Tween class.
It's as simple as before except the classes which needs to be imported are different. So for AS3 we will import fl.transitions.Tween & fl.transitions.easing.*
Please use the code below to simply animate a box kept on the stage using Tween class-
import fl.transitions.Tween;
import fl.transitions.easing.*;
b1.buttonMode = true;
b1.addEventListener(MouseEvent.CLICK, btnclick);
function btnclick(event:MouseEvent)
{
new Tween(b1,"x",Regular.easeOut, b1.x, b1.x+50,1, true);
}
Subscribe to:
Posts (Atom)