<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Ladislav Hajabacs</title>
	<atom:link href="http://www.hajabacs.eu/index.php?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.hajabacs.eu</link>
	<description>RIA developer</description>
	<pubDate>Sat, 19 Dec 2009 19:14:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Why to (not) use Adobe AIR! An open letter for Adobe.</title>
		<link>http://www.hajabacs.eu/?p=84</link>
		<comments>http://www.hajabacs.eu/?p=84#comments</comments>
		<pubDate>Mon, 05 Jan 2009 13:48:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hajabacs.eu/?p=84</guid>
		<description><![CDATA[As the AIR 2.0 is in beta now I have to edit this post, and add a link to the capabilities of the new version as it solves lot of limitations of the previous versions. Check it here.
I would do it much earlier because lot of projects had to be done using other programming languages. [...]]]></description>
			<content:encoded><![CDATA[<p>As the AIR 2.0 is in beta now I have to edit this post, and add a link to the capabilities of the new version as it solves lot of limitations of the previous versions. <a href="http://labs.adobe.com/technologies/air2/">Check it here</a>.</p>
<p>I would do it much earlier because lot of projects had to be done using other programming languages. But it&#8217;s not me who lost money due to the limitations of AIR. They have to know the reasons why they make those limitations, and degraded AIR to be a widget creation tool.</p>
<p>The original post (hope it&#8217;s meaningless now):</p>
<p>I don&#8217;t know what Adobe thinks, but ignoring user (their customers) is a really dangerous thing to do.</p>
<p>I have a problem with launching external application from an AIR apllication. I don&#8217;t want it because I have nothing else to do, I need to do it. ( Actually the client needs to do it, so I have to be able to do it.)  I think lots of people had/have this problem.</p>
<p>I don&#8217;t know what&#8217;s the point that even some music player software has bigger privileges than I could dream off with AIR? If we develop dekstop application, we have to have the same possibilities as other applications have. The installer could warn the users that this application is capable of doing that, and that&#8217;s it.</p>
<p>It&#8217;s not so funny to make some installers and try to bypass this stupid restriction! Adobe even doesn&#8217;t allow to distribute just the files and make what how I want things to work, I have to use their installer. (As I know useing <a href="http://www.shu-player.com/">shu-player</a> is not as much legal, but I might end up useing it anyway)</p>
<p>So I could ask: How to solve it? I don&#8217;t know what are the plans in Adobe with AIR, but I cannot see bright future for it if Adobe will ignore what people need. If there will be other choice I will surely go that way. I don&#8217;t like to be in this kind of situation (be a hostage), when I am fully in a hands of some company (who doesnt really care).</p>
<p>Uff.</p>
<p>Ps: If you agree with me, don&#8217;t just pray for some change. Let them know what you want!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hajabacs.eu/?feed=rss2&amp;p=84</wfw:commentRss>
		</item>
		<item>
		<title>Want custom animation or different functionality under a modal window?</title>
		<link>http://www.hajabacs.eu/?p=71</link>
		<comments>http://www.hajabacs.eu/?p=71#comments</comments>
		<pubDate>Fri, 10 Oct 2008 16:30:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[AIR]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[modal window]]></category>

		<category><![CDATA[PopUP]]></category>

		<guid isPermaLink="false">http://www.hajabacs.eu/?p=71</guid>
		<description><![CDATA[When I wanted to take control over the shield that makes a window appear modal, I found out, that it seams to be not really implemented. I’ve found the functionality in the mx.managers.PopUpManagerImpl class in the Flex framework. 

There is a property called modalWindowClass that if you set, it will be used as a shield.(Actually [...]]]></description>
			<content:encoded><![CDATA[<p>When I wanted to take control over the shield that makes a window appear modal, I found out, that it seams to be not really implemented. I’ve found the functionality in the mx.managers.PopUpManagerImpl class in the Flex framework. </p>
<p><span id="more-71"></span></p>
<p>There is a property called modalWindowClass that if you set, it will be used as a shield.(Actually the graphics object of this class will be cleared even that time, there is a little mess in the code in the PopUpManagerImpl class.)</p>
<p>I did a little repair, with this it works beter for me. I avoid to draw to the graphics object when the class is set. I added a condition:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>466
467
468
469
470
471
</pre></td><td class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>modalWindowClass<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>    
	        g.<span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	        g.<span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">c</span>, <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span>;
	        g.<span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>s.<span style="color: #004993;">x</span>, s.<span style="color: #004993;">y</span>, s.<span style="color: #004993;">width</span>, s.<span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span>;
	        g.<span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The application code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
</pre></td><td class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;300&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;300&quot;</span> applicationComplete=<span style="color: #990000;">&quot;init();&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
			<span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.Alert;
			<span style="color: #0033ff; font-weight: bold;">import</span> mx.managers.PopUpManager;
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">import</span> mx.managers.PopUpManagerImpl;
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">import</span> mx.core.mx_internal;
&nbsp;
			use <span style="color: #004993;">namespace</span> mx_internal;
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> impl<span style="color: #000000; font-weight: bold;">:</span>PopUpManagerImpl=PopUpManagerImpl.getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> PopUpManagerImpl;
				impl.modalWindowClass=CustomPopUpShield;
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> openPopUp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
&nbsp;
&nbsp;
				Alert.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;hehe&quot;</span>,<span style="color: #990000;">&quot;Try pop up&quot;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Style<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #3f5fbf;">/*With these settings I practically turned off the default behavior. The transparency have to be 1, 
		because it will be the transparency for the whole shield.(with 0 we would not see anything)*/</span>
		Application<span style="color: #000000;">&#123;</span>
			horizontalGap<span style="color: #000000; font-weight: bold;">:</span><span style="color: #990000;">&quot;0&quot;</span>;
    		modalTransparency<span style="color: #000000; font-weight: bold;">:</span><span style="color: #990000;">&quot;1&quot;</span>;
    		modalTransparencyBlur<span style="color: #000000; font-weight: bold;">:</span><span style="color: #990000;">&quot;0&quot;</span>;
    		modalTransparencyColor<span style="color: #000000; font-weight: bold;">:</span><span style="color: #990000;">&quot;#ffffff&quot;</span>;
    		modalTransparencyDuration<span style="color: #000000; font-weight: bold;">:</span><span style="color: #990000;">&quot;0&quot;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Style<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>HBox horizontalGap=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>VBox <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;60&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Click!&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;openPopUp()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Click!&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;openPopUp()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Click!&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;openPopUp()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Click!&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;openPopUp()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Click!&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;openPopUp()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Click!&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;openPopUp()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Click!&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;openPopUp()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>VBox<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;240&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;#0000ff&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;102&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;47&quot;</span> label=<span style="color: #990000;">&quot;click&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;openPopUp()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>HBox<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>The custom pop up shield class (The target is to make the buttons unclickable of course, but over the left side I don’t want to see visible shield. Not the whole screen will be filled with color. I made the shield animated too):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
</pre></td><td class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span>.<span style="color: #004993;">BlurFilter</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span>.<span style="color: #004993;">GlowFilter</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<span style="color: #004993;">Rectangle</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> gs.TweenMax;
	<span style="color: #0033ff; font-weight: bold;">import</span> gs.easing.Back;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.core.Application;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CustomPopUpShield extends <span style="color: #004993;">Sprite</span>
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _base<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span>;<span style="color: #009900;">//this will be an invisible shape over the whole screen to prevent clicking on the buttons</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _animatingContent<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span>;<span style="color: #009900;">//this will animate</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomPopUpShield<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #6699cc; font-weight: bold;">var</span> sc<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Rectangle</span>=Application.application.screen;
&nbsp;
			_base=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			_base.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x000000,0<span style="color: #000000;">&#41;</span>;
			_base.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>0,0,sc.<span style="color: #004993;">width</span>,sc.<span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span>;
			_base.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>_base<span style="color: #000000;">&#41;</span>;
&nbsp;
			_animatingContent=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			_animatingContent.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x00ff00,<span style="color: #000000; font-weight:bold;">0.4</span><span style="color: #000000;">&#41;</span>;
			_animatingContent.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">60</span>,0,sc.<span style="color: #004993;">width</span>,sc.<span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span>;
			_animatingContent.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>_animatingContent<span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">filter</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">GlowFilter</span>=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">GlowFilter</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">4</span>,<span style="color: #000000; font-weight:bold;">4</span><span style="color: #000000;">&#41;</span>;
			_animatingContent.<span style="color: #004993;">filters</span>=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">filter</span><span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #004993;">activate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">activate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
			TweenMax.to<span style="color: #000000;">&#40;</span>_animatingContent, <span style="color: #000000; font-weight:bold;">1</span>, <span style="color: #000000;">&#123;</span>tint<span style="color: #000000; font-weight: bold;">:</span>0x000000,yoyo<span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">true</span>,ease<span style="color: #000000; font-weight: bold;">:</span>Back.easeIn<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span> 
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The result:<br />
<object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/CustomModalWindowBackground.swf" width="300" height="300" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/CustomModalWindowBackground.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>Everything is hardcoded in this example. You may need to manage resizing etc. But you can make this way your very own pop up shield, whatever you want. </p>
<p>Source for this project: <a href="http://www.hajabacs.eu/exampleSources/CustomModalWindowBackground.zip">CustomModalWindowBackground.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hajabacs.eu/?feed=rss2&amp;p=71</wfw:commentRss>
		</item>
		<item>
		<title>The white rectangle attacks!</title>
		<link>http://www.hajabacs.eu/?p=41</link>
		<comments>http://www.hajabacs.eu/?p=41#comments</comments>
		<pubDate>Tue, 07 Oct 2008 15:22:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[AIR]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[private]]></category>

		<category><![CDATA[protected]]></category>

		<guid isPermaLink="false">http://www.hajabacs.eu/?p=41</guid>
		<description><![CDATA[Before this post check: When simple overriding is not possible!
In this post I will show why would you have to change the flex classes code.
I had hard times with this problem. When both scrollers appear in a container in the same time, a white rectangle is created in the corner. First I thought it’s something [...]]]></description>
			<content:encoded><![CDATA[<p>Before this post check: <a href="http://www.hajabacs.eu/?p=32">When simple overriding is not possible!</a></p>
<p>In this post I will show why would you have to change the flex classes code.<br />
I had hard times with this problem. When both scrollers appear in a container in the same time, a white rectangle is created in the corner. First I thought it’s something with the scroller (that’t why I didn’t find the solution). But I’ve found it! And I have to ask a question: Why is that the the rectangle have to be white, and it is hardcoded there? </p>
<p><span id="more-41"></span></p>
<p>The code from the Container class:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
</pre></td><td class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;">        <span style="color: #009900;">// Create or destroy the whiteBox.</span>
        <span style="color: #009900;">// If both scrollBars are active, there's an empty space</span>
        <span style="color: #009900;">// between the two scrollBars in the lower right corner.</span>
        <span style="color: #009900;">// The whiteBox fills that space, so that the container's</span>
        <span style="color: #009900;">// children aren't visible when they scroll underneath.</span>
        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>horizontalScrollBar <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> verticalScrollBar<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>whiteBox<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                whiteBox = <span style="color: #0033ff; font-weight: bold;">new</span> FlexShape<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                whiteBox.<span style="color: #004993;">name</span> = <span style="color: #990000;">&quot;whiteBox&quot;</span>;
&nbsp;
                <span style="color: #6699cc; font-weight: bold;">var</span> g<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Graphics</span> = whiteBox.<span style="color: #004993;">graphics</span>;
                g.<span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0xFFFFFF<span style="color: #000000;">&#41;</span>;
                g.<span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>0, 0, verticalScrollBar.minWidth, horizontalScrollBar.minHeight<span style="color: #000000;">&#41;</span>;
                g.<span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
                rawChildren.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>whiteBox<span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The default container with the white rectangle:<br />
<object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/TheWhiteRectangleAttacks_bad.swf" width="300" height="300" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/TheWhiteRectangleAttacks_bad.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>So let’s make an quick change. I will just put there a public property so I can change it easily (I can set the color just on creation, to make a better solution use styles).</p>
<p>I added</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"> <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> whiteRectangleColor<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>=0xFFFFFF;</pre></div></div>

<p>and made this change</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;">g.<span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>whiteRectangleColor<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>in the Container Class. So now every class that extends container can change that whiteRectangle color, and actually the default behavior was not changed.</p>
<p>So the code that uses this is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;300&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;300&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Panel <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;#00ff00&quot;</span> whiteRectangleColor=<span style="color: #990000;">&quot;#00ff00&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;400&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;400&quot;</span> <span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;#0000ff&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Did you ever tried to find out why is that white rectangle there in the down-right corner? (Between the scrollers)&quot;</span> 
					<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;253&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;236&quot;</span> <span style="color: #004993;">fontSize</span>=<span style="color: #990000;">&quot;25&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas<span style="color: #000000; font-weight: bold;">&gt;</span> 
		<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Panel<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>And the result: a super good looking green rectangle (with grey it would look better, atually i could change the size it looks a little big for me):</p>
<p><object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/TheWhiteRectangleAttacks.swf" width="300" height="300" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/TheWhiteRectangleAttacks.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>Actually this is not the best example for such a hack. You cannot control the drawing the container, because it’s a private funtion. It will use white color, but the whiteBox variable is protected, so there is access to it. (You have to clear the graphics for it, and draw other rectangle with different color after the rectangle was created. And you have to do it every time, when both the scrollers appear, because the rectangle is always destroyed if not needed. So this hack is an easier solution, but not the only for this problem)</p>
<p>Source for this project: <a href="http://www.hajabacs.eu/exampleSources/TheWhiteRectangleAttacks.zip">TheWhiteRectangleAttacks.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hajabacs.eu/?feed=rss2&amp;p=41</wfw:commentRss>
		</item>
		<item>
		<title>Datagrid ColumnWidht with fixed ratio!</title>
		<link>http://www.hajabacs.eu/?p=36</link>
		<comments>http://www.hajabacs.eu/?p=36#comments</comments>
		<pubDate>Tue, 07 Oct 2008 15:21:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[AIR]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[DataGrid]]></category>

		<guid isPermaLink="false">http://www.hajabacs.eu/?p=36</guid>
		<description><![CDATA[Before this post check: When simple overriding is not possible!
Here I will show how to override private functions for the Flex framework classes. If you want the DataGrid to have fix column ratios, that will never change try this.

The problem is the DataGridColumn width property. It is not simple a width property.
The documentation says: DataGrid [...]]]></description>
			<content:encoded><![CDATA[<p>Before this post check: <a href="http://www.hajabacs.eu/?p=32">When simple overriding is not possible!</a><br />
Here I will show how to override private functions for the Flex framework classes. If you want the DataGrid to have fix column ratios, that will never change try this.<br />
<span id="more-36"></span><br />
The problem is the DataGridColumn width property. It is not simple a width property.<br />
The documentation says: DataGrid will not always honor the width of the columns if the total width of the columns is too small or too large for the displayable area.(DataGridColumn : width property)</p>
<p>So as I see it: It will take the values first rather as a ratio. If you set 3 columns like 30,60,10 pixels width, it will result in columns as 30,60,10 percent of the width of the datagrid.<br />
But when you start to resize it the ratio will disapear. After some resizes of the datagrid you will see that the columns will likely to be the same size at the end. (I think that this is a bug.)</p>
<p>Code: (I used the same code for all the examples but I switched off my solution to get the default behavior when it was needed)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
</pre></td><td class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;!--</span> DataGrid control example. <span style="color: #000000; font-weight: bold;">--&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> xmlns<span style="color: #000000; font-weight: bold;">:</span>gridOld=<span style="color: #990000;">&quot;mx.controls.*&quot;</span>
	xmlns<span style="color: #000000; font-weight: bold;">:</span>gridNew=<span style="color: #990000;">&quot;*&quot;</span> horizontalScrollPolicy=<span style="color: #990000;">&quot;off&quot;</span> verticalScrollPolicy=<span style="color: #990000;">&quot;off&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;500&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;220&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XMLList</span> id=<span style="color: #990000;">&quot;employees&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;</span>employee<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>Christina Coenraets<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>phone<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">555</span><span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">219</span><span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">2270</span><span style="color: #000000; font-weight: bold;">&lt;/</span>phone<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>email<span style="color: #000000; font-weight: bold;">&gt;</span>ccoenraets@fictitious.com<span style="color: #000000; font-weight: bold;">&lt;/</span>email<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>active<span style="color: #000000; font-weight: bold;">&gt;</span>true<span style="color: #000000; font-weight: bold;">&lt;/</span>active<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;/</span>employee<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;</span>employee<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>Joanne Wall<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>phone<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">555</span><span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">219</span><span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">2012</span><span style="color: #000000; font-weight: bold;">&lt;/</span>phone<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>email<span style="color: #000000; font-weight: bold;">&gt;</span>jwall@fictitious.com<span style="color: #000000; font-weight: bold;">&lt;/</span>email<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>active<span style="color: #000000; font-weight: bold;">&gt;</span>true<span style="color: #000000; font-weight: bold;">&lt;/</span>active<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;/</span>employee<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;</span>employee<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>Maurice Smith<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>phone<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">555</span><span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">219</span><span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">2012</span><span style="color: #000000; font-weight: bold;">&lt;/</span>phone<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>email<span style="color: #000000; font-weight: bold;">&gt;</span>maurice@fictitious.com<span style="color: #000000; font-weight: bold;">&lt;/</span>email<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>active<span style="color: #000000; font-weight: bold;">&gt;</span>false<span style="color: #000000; font-weight: bold;">&lt;/</span>active<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;/</span>employee<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;</span>employee<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>Mary Jones<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>phone<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">555</span><span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">219</span><span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">2000</span><span style="color: #000000; font-weight: bold;">&lt;/</span>phone<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>email<span style="color: #000000; font-weight: bold;">&gt;</span>mjones@fictitious.com<span style="color: #000000; font-weight: bold;">&lt;/</span>email<span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>active<span style="color: #000000; font-weight: bold;">&gt;</span>true<span style="color: #000000; font-weight: bold;">&lt;/</span>active<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;/</span>employee<span style="color: #000000; font-weight: bold;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>XMLList<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
			<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> startSize<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">300</span>;<span style="color: #009900;">//change this startSize, and recompile to see the changes</span>
		<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Style<span style="color: #000000; font-weight: bold;">&gt;</span>
		DataGrid <span style="color: #000000;">&#123;</span>
			   alternatingItemColors<span style="color: #000000; font-weight: bold;">:</span> #006699, #006655;
			<span style="color: #000000;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Style<span style="color: #000000; font-weight: bold;">&gt;</span>
  		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Label <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;datagrid startSize: {startSize}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;</span>gridNew<span style="color: #000000; font-weight: bold;">:</span>EditedDatagrid headerHeight=<span style="color: #990000;">&quot;0&quot;</span> showHeaders=<span style="color: #990000;">&quot;false&quot;</span>  id=<span style="color: #990000;">&quot;dg&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;{startSize}&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;104&quot;</span> rowCount=<span style="color: #990000;">&quot;5&quot;</span> dataProvider=<span style="color: #990000;">&quot;{employees}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;</span>gridNew<span style="color: #000000; font-weight: bold;">:</span>columns<span style="color: #000000; font-weight: bold;">&gt;</span>
                <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>DataGridColumn dataField=<span style="color: #990000;">&quot;name&quot;</span> headerText=<span style="color: #990000;">&quot;Name&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;30&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span> 
                <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>DataGridColumn dataField=<span style="color: #990000;">&quot;phone&quot;</span> headerText=<span style="color: #990000;">&quot;Phone&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;60&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
                <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>DataGridColumn dataField=<span style="color: #990000;">&quot;email&quot;</span> headerText=<span style="color: #990000;">&quot;Email&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;10&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
            <span style="color: #000000; font-weight: bold;">&lt;/</span>gridNew<span style="color: #000000; font-weight: bold;">:</span>columns<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;/</span>gridNew<span style="color: #000000; font-weight: bold;">:</span>EditedDatagrid <span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Change the size with this slider 10-20 times to see what I am talking about.&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;33&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;231&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>HSlider <span style="color: #004993;">value</span>=<span style="color: #990000;">&quot;{startSize}&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;400&quot;</span> minimum=<span style="color: #990000;">&quot;{this.width/2}&quot;</span> maximum=<span style="color: #990000;">&quot;{this.width}&quot;</span> snapInterval=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">enabled</span>=<span style="color: #990000;">&quot;true&quot;</span> <span style="color: #004993;">change</span>=<span style="color: #990000;">&quot;dg.width=slider.value;&quot;</span> id=<span style="color: #990000;">&quot;slider&quot;</span> liveDragging=<span style="color: #990000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>The first build with datagrid width 300.(default datagrid behavior, watch the ratios on creation and after resizes)<br />
<object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/DatagridHackUnchanged300.swf" width="500" height="220" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/DatagridHackUnchanged300.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>The first build with datagrid width 500. (default datagrid behavior, watch the ratios on creation and after resizes)<br />
<object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/DatagridHackUnchanged500.swf" width="500" height="220" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/DatagridHackUnchanged500.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>You can see the ratios changing! And the columns surely don&#8217;t have the good widths.</p>
<p>I decided to make the ratio always the same.(You could fix the column sizes too, but you may not see some columns if the datagrid is small. Fixing size is not the best thing to do.)</p>
<p>I don’t know if it can be done other way but it works this way for sure.<br />
One function „calculateColumnSizes” was made protected in the DataGrid class (this is the original DataGrid made by Adobe) so EditedDatagrid class can override it.</p>
<p>Code: (EditedDatagrid overrides the calculateColumnSizes function. In the DataGrid I just changed private to protected. You can download all the files.)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
</pre></td><td class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.DataGrid;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.dataGridClasses.DataGridColumn;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.core.mx_internal;
&nbsp;
	use <span style="color: #004993;">namespace</span> mx_internal;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> EditedDatagrid extends DataGrid<span style="color: #000000;">&#123;</span> 
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> EditedDatagrid<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
	    <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> firstRun<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span>=<span style="color: #0033ff; font-weight: bold;">true</span>;
	    <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> ratioSizes<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span>;
&nbsp;
	    <span style="color: #0033ff; font-weight: bold;">protected</span> override <span style="color: #339966; font-weight: bold;">function</span> calculateColumnSizes<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	    	<span style="color: #6699cc; font-weight: bold;">var</span>  n<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = visibleColumns.<span style="color: #004993;">length</span>;
	    	<span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=0;
&nbsp;
	       <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>firstRun<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		       ratioSizes=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span>n<span style="color: #000000;">&#41;</span>;
		       <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span>i = 0; i <span style="color: #000000; font-weight: bold;">&lt;</span> n; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		         	ratioSizes<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>=<span style="color: #000000;">&#40;</span>visibleColumns<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> <span style="color: #0033ff; font-weight: bold;">as</span> DataGridColumn<span style="color: #000000;">&#41;</span>.<span style="color: #004993;">width</span>;<span style="color: #009900;">//remenber the widths before calling calculateColumnSizes</span>
		       <span style="color: #000000;">&#125;</span>
		       firstRun=<span style="color: #0033ff; font-weight: bold;">false</span>;
	       <span style="color: #000000;">&#125;</span>
	       <span style="color: #3f5fbf;">/*it was needed to call this even if the result is overriden, 
	         it inicializes some things that would be missed*/</span>       
	       <span style="color: #0033ff; font-weight: bold;">super</span>.calculateColumnSizes<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
	       <span style="color: #009900;">//return; /*uncomment this &quot;return&quot; to see the default behaviour*/</span>
&nbsp;
	    	<span style="color: #009900;">//setting the previous ratios for the columns</span>
&nbsp;
	    	<span style="color: #6699cc; font-weight: bold;">var</span> newWidths<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span>=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span>n<span style="color: #000000;">&#41;</span>;
	    	<span style="color: #6699cc; font-weight: bold;">var</span> dataGridWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">width</span>;
	    	<span style="color: #6699cc; font-weight: bold;">var</span> ratioNum<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=sum<span style="color: #000000;">&#40;</span>ratioSizes<span style="color: #000000;">&#41;</span>;
	    	<span style="color: #6699cc; font-weight: bold;">var</span> ratioDivider<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=0;
&nbsp;
	    	<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>ratioNum==0<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>  
				<span style="color: #0033ff; font-weight: bold;">throw</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Error</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;cannot divide with 0&quot;</span><span style="color: #000000;">&#41;</span>;
	    	<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
	    		ratioDivider=<span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000; font-weight: bold;">/</span>ratioNum;	    		
	    	<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span>i = 0; i <span style="color: #000000; font-weight: bold;">&lt;</span> n<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span>; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><span style="color: #009900;">//we dont care about the last column now (so n-1)</span>
	            <span style="color: #000000;">&#40;</span>visibleColumns<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> <span style="color: #0033ff; font-weight: bold;">as</span> DataGridColumn<span style="color: #000000;">&#41;</span>.setWidth<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>ratioSizes<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">*</span>ratioDivider<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>dataGridWidth<span style="color: #000000;">&#41;</span>;<span style="color: #009900;">//the previouse width will be set to it</span>
	            <span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #3f5fbf;">/* The calculation is this strange because the ratios could be 40+70+90=200 % (youdont have to make the sum 100%)
			 * ratioDivider=0.5;  (100/200  100% is the max) 
			 * so for the first column ((0.5*40)/100)*width  (/100 to make it percent)			  
			 */</span>			
			<span style="color: #0033ff; font-weight: bold;">return</span>;   	
	    <span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> sum<span style="color: #000000;">&#40;</span>arr<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> sum<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=0;
			<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=0;i<span style="color: #000000; font-weight: bold;">&lt;</span>arr.<span style="color: #004993;">length</span>;i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>arr<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> <span style="color: #0033ff; font-weight: bold;">is</span> <span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
					sum<span style="color: #000000; font-weight: bold;">+</span>=arr<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>;
				<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
					<span style="color: #0033ff; font-weight: bold;">throw</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Error</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;something is really wrong!&quot;</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">return</span> sum;
		<span style="color: #000000;">&#125;</span>	
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The first build with datagrid width 300.(changed datagrid behavior)<br />
<object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/DatagridHackFixedRatio300.swf" width="500" height="220" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/DatagridHackFixedRatio300.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>The first build with datagrid width 500.(changed datagrid behavior)<br />
<object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/DatagridHackFixedRatio500.swf" width="500" height="220" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/DatagridHackFixedRatio500.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>Now the ratios doesn&#8217;t change!</p>
<p>There are usually problems when you try to hack a component, always think, how big change you need. Maybe it would be better to make your own component. This hacking works well if there is just one little problem. (It can take some time to play/debug with the code, to find the function that makes the problems.)</p>
<p>If you know other way to fix the column size/ratio send a comment.</p>
<p>I used this just as an example, how to deal with such a problems, when you have to override private functions. On the next post I will show when this won’t be enough to succeed.</p>
<p>Source for this project: <a href="http://www.hajabacs.eu/exampleSources/OverrideComponents.zip">OverrideComponents.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hajabacs.eu/?feed=rss2&amp;p=36</wfw:commentRss>
		</item>
		<item>
		<title>When simple overriding is not possible!</title>
		<link>http://www.hajabacs.eu/?p=32</link>
		<comments>http://www.hajabacs.eu/?p=32#comments</comments>
		<pubDate>Tue, 07 Oct 2008 15:21:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[AIR]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[override]]></category>

		<category><![CDATA[private]]></category>

		<category><![CDATA[protected]]></category>

		<guid isPermaLink="false">http://www.hajabacs.eu/?p=32</guid>
		<description><![CDATA[Sometimes I  wanted to override a function of  Flex component, but it was private. So what to do? If I need just a little change, or I just found a little bug there, and don’t want to make a component from scratch! Let’s go little more extreme.

I tried to make a new class [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I  wanted to override a function of  Flex component, but it was private. So what to do? If I need just a little change, or I just found a little bug there, and don’t want to make a component from scratch! Let’s go little more extreme.<br />
<span id="more-32"></span><br />
I tried to make a new class with the code of the component, but it it was mistake. There were always some base classes of the actual compnents, and those can mess things up really quickly. The problem is usually with the baseclasses somewhere, and usually just on runtime. Like cannot cast something to something (because of the different name of my new class) etc. So good luck with this.</p>
<p>The better way is to copy the frameworks class to your source folder, and make changes in that. This way you can make changes to some really base classes too,not just what you want to extend. You will need to maintain the package structure, without that you would never know which version you actually use. Flex builder will prefer the classes from your source folder over the swc of the framework. So the one in your source folder will be used to compile this project. I think it may slow down the compilation, not sure. If later the sdk will be changed and these classes will not be updated, it can be a problem.</p>
<p>The flex framework source folder on my pc is in (we want to the skd-3): c:\Program Files\Adobe\Flex Builder3\sdks\3.0.0\frameworks\projects\framework\src\mx\</p>
<p>There is a notice in that folder:<br />
All of the files contained in this directory and any subdirectories are considered &#8220;SDK Source Files&#8221; under the terms of the end user license agreement that accompanies this product. Please consult such end user license agreement for details about your rights with respect to such files.</p>
<p>So I don’t really know if I am allowed to make these changes, but I will show you how to do them. (It would be a lot easier to write: You cannot use these files! You can use these files!) Sometimes you will need to use them.</p>
<p>There can be several files included in the class, you will have to add those to the source folder too. Many classes include some code, you will need them to compile the code.</p>
<p>There can be problems with the Flex builder, it may keep delete the next lines of code if Flex is set to manage imports. Check the original files where these lines have to go.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> mx.core.mx_internal;
use <span style="color: #004993;">namespace</span> mx_internal;</pre></div></div>

<p>Just be aware of this.</p>
<p>Now you can start!<br />
The best thing to do is just to change private functions to protected ones. There is not big risk. Then you can extend the class and override the functions. Whatever you want. Theoretically you should do always this, make changes to the base class to allow more changes, but use it’s extended version in your code. Problems can for example that the function should be called after something else was set, and you will mess things up. This can happen with variables too, the components will be in inconsistent state after you set some variable by your own way. It’s your own risk.</p>
<p>Sometimes this is not enough, you have to make change in the code. It’s really important to not change the default behavior of the class. If you change something it will affect it’s every instance. Other developers in your team (working on the same project) may not really like what you did. Because you probably use SVN everybody will have the same changed version of the basic class, with the same changed functionality. So be avare what are you doing! You can put some conditions, to not change the default behavior. Make sure the functionality didn’t change! The changed class may be copied, and used in different project by different people, they will go mad.</p>
<p>I decided to divide this post. To <a href="http://www.hajabacs.eu/?p=36">Datagrid ColumnWidht with fixed ratio!</a> and <a href="http://www.hajabacs.eu/?p=41">The white rectangle attacks!</a></p>
<p>sources for those posts:<br />
<a href="http://www.hajabacs.eu/exampleSources/OverrideComponents.zip">OverrideComponents.zip</a><br />
<a href="http://www.hajabacs.eu/exampleSources/TheWhiteRectangleAttacks.zip">TheWhiteRectangleAttacks.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hajabacs.eu/?feed=rss2&amp;p=32</wfw:commentRss>
		</item>
		<item>
		<title>Embedding symbols while maintain their classes!</title>
		<link>http://www.hajabacs.eu/?p=17</link>
		<comments>http://www.hajabacs.eu/?p=17#comments</comments>
		<pubDate>Sun, 05 Oct 2008 11:35:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[AIR]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[embed]]></category>

		<category><![CDATA[SWF]]></category>

		<category><![CDATA[symbol]]></category>

		<guid isPermaLink="false">http://www.hajabacs.eu/?p=17</guid>
		<description><![CDATA[Sometimes you just want to embed a symbol from an SWF file what you made with the Flash IDE, but you can have problems. The symbol will not have information about the linked class. You will lose all the functionality that was there, the symbols child objects lose everything too. So how to embed the [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you just want to embed a symbol from an SWF file what you made with the Flash IDE, but you can have problems. The symbol will not have information about the linked class. You will lose all the functionality that was there, the symbols child objects lose everything too. So how to embed the symbol and maintain the connection with the linked classes?</p>
<p><span id="more-17"></span></p>
<p>Lets see the original swf what we will use for embedding. There is a Ball symbol with a SimpleRectangle child. The Ball resizes on mouse over/out events. The rectangle rotates and changes color on mouse over/out events.</p>
<p>This is the original swf (which has the ball on the stage) file symbolSource.swf:<br />
<object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/symbolSource.swf" width="300" height="300" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/symbolSource.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object><br />
All the actions are done in the classes.</p>
<p>If you try to embed the symbol (Ball) you will lost all the functionality:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;">&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;!--</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
			<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;assets/symbolSource.swf&quot;</span>, symbol=<span style="color: #990000;">'Ball'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">--&gt;</span></pre></div></div>

<p>And the result functionality, nothing:<br />
<object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/EmbedJustTheSymbol.swf" width="300" height="300" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/EmbedJustTheSymbol.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>And now try the other way, embed the whole SWF file:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;">&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;!--</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
			<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;assets/symbolSource.swf&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">--&gt;</span></pre></div></div>

<p>And everything works:<br />
<object type="application/x-shockwave-flash" data="http://www.hajabacs.eu/wp-content/uploads/EmbedWholeSWF.swf" width="300" height="300" class="embedflash"><param name="movie" value="http://www.hajabacs.eu/wp-content/uploads/EmbedWholeSWF.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>The trick is that even if you embed the whole SWF, when you make new instance you have to wait while it is loaded, and after you can get the classes from the SWF file.</p>
<p>The whole source:<a href="http://www.hajabacs.eu/exampleSources/EmbeddingSymbol.rar">EmbeddingSymbol.rar</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hajabacs.eu/?feed=rss2&amp;p=17</wfw:commentRss>
		</item>
		<item>
		<title>Waiting for Flash Player to connect to debugger!</title>
		<link>http://www.hajabacs.eu/?p=8</link>
		<comments>http://www.hajabacs.eu/?p=8#comments</comments>
		<pubDate>Sun, 05 Oct 2008 11:09:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[debug]]></category>

		<category><![CDATA[localhost]]></category>

		<guid isPermaLink="false">http://www.hajabacs.eu/?p=8</guid>
		<description><![CDATA[I think lot of Flex users saw this error coming up so lets see what we have here.
The most annoying thing is that it seems that there are more actual solutions (so the problem can be very frustrating).

There are more solutions to this problem like:
http://kb.adobe.com/selfservice/viewContent.do?externalId=758bf58b&#38;sliceId=2
I found that my problem was the same as in this [...]]]></description>
			<content:encoded><![CDATA[<p>I think lot of Flex users saw this error coming up so lets see what we have here.</p>
<p>The most annoying thing is that it seems that there are more actual solutions (so the problem can be very frustrating).</p>
<p><span id="more-8"></span></p>
<p>There are more solutions to this problem like:<br />
<a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=758bf58b&amp;sliceId=2">http://kb.adobe.com/selfservice/viewContent.do?externalId=758bf58b&amp;sliceId=2</a></p>
<p>I found that my problem was the same as in this site:<br />
<a href="http://therush.wordpress.com/2008/03/11/resolved-flex-builder-3-debugger-stopped-working/">http://therush.wordpress.com/2008/03/11/resolved-flex-builder-3-debugger-stopped-working/</a></p>
<p>But it just doesnt make any sense. The solution  for them was to change the debugger from &#8220;localhost&#8221; to 127.0.0.1. (Right click on the flash player and choose debugger) But why? For me setting the new IP (127.0.0.1) for the debugger worked. They are the same I thought.<br />
So I checked the hosts file. I opened:</p>
<p>C:\WINDOWS\system32\drivers\etc\hosts</p>
<p>And it had this in it:<br />
::1             localhost  //this is the problem (not sure that ::1 was the IP but it doesnt matter)<br />
127.0.0.1       localhost</p>
<p>So I had 2 localhost defined (one with some strange thing)</p>
<p>I remoded the bad IP (::1) so just the<br />
127.0.0.1       localhost<br />
remain and of course it works now!</p>
<p>I don&#8217;t have any idea how (and why) could it happen, that Flex (or any other program) wrote that stupid thing in my host file (I checked for viruses but I didn&#8217;t find anything&#8230;)</p>
<p>I try sum the possible solutions here:</p>
<p>1. Restart Flex<br />
2. check you host file</p>
<p>If you have some other ideas I will sum them up here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hajabacs.eu/?feed=rss2&amp;p=8</wfw:commentRss>
		</item>
	</channel>
</rss>
