Articles Tagged 'class'
The standard WordPress template (as others) normally provide for an alternate layout for the list of comments. In the standard template of a class instance is set css alt , according to the logic:
1 2 3 4 5
| / / Comments.php $oddcomment ; ?> id="comment- <?php comment_ID ( ) ?> "> <Li <? Php echo $ oddcomment;?> Id = "comment-<? Php COMMENT_ID ()?>"> [...] / * Changes every other comment to a different class * / Oddcomment = $ (empty ($ oddcomment))? 'Class = "alt"':''; |
) e una volta a class="alt" . This means that the tag li $oddcomment is set once a blank ( "" ) and once a class="alt" . A modification could be useful to introduce another class when the author of the blog to post a comment:

I, for example, I used the following code in comments.php:
1 2 3 4 5
| <? Php ( $comment -> user_id == 3 ) ? ' Authcomment = $ ($ comment -> user_id == 3)? ' '' ; authcomment ':''; ( empty ( $classcomment ) ) ? ( ( $authcomment == '' ) ? ' alt' : '' ) : '' ; Classcomment = $ ( empty ($ classcomment))? (($ authcomment =='')? 'alt':''):''; ?> ?> <?= $authcomment ?> " id="comment- <?php comment_ID ( ) ?> "> <Li class = "<? = $ Classcomment?> <? = $ Authcomment?>" Id = "comment-<? Php COMMENT_ID ()?>"> |
del vostro utente. The line $comment->user_id==3 may vary according to ' ID of your user. I, for one, do not use the administrator to respond on the blog, but I have my user ID=3 . , se usate questa utenza potete scrivere: $comment->user_id==1 . Normally the ' ID of the administrator is 1 , if you use this utility you can write: $comment->user_id==1 . In this way not only to have the alternate layout on the comments left by visitors, the answer is immediately recognizable author of the blog.
More ...
AdminBigWidth is a plugin for WordPress that can set the working area of the administration in full screen. It is a plugin really simple and trivial, in fact his code does is change the CSS class .wrap :
1 2 3 4
| AdminBigWidth function () { ; echo '<style type="text/css">. wrap {max-width: none} </ style>'; } , 'AdminBigWidth' ) ; add_action ('admin_head', 'AdminBigWidth'); |
For those like me who uses the WordPress editor in HTML mode could be useful to set a monospaced font such as Courier, instead of the proposed default font. In this way, at least for developers, it is easier to align source code. To do this just add, in the style of AdminBigWidth , a new approach to CSS that is reflected when the editor is in HTML mode. You could write a plugin (two lines) to do this, but it is better to use your code AdminBigWidth , thus avoiding an additional load due to the nth Plugin:
1 2 3 4
| AdminBigWidth function () { ; echo '<style type="text/css">. wrap {max-width: none} # editorcontainer # content {font-family: "Courier New", Courier, monospace} </ style>'; } , 'AdminBigWidth' ) ; add_action ('admin_head', 'AdminBigWidth'); |
More ...
In the post with 3D CountDown FIVe3D (see also How I Did It: write a countdown in Flash ), was given a class for creating an object in Actionscript CountDown, here's a similar version in Javascript:
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
| / ** * Class CountDown * * @ Author Giovambattista Fazioli * @ @ Email g.fazioli undolog.com * @ Web http://www.undolog.com * * @ Param dd (string) 'month day, year' * * / dd ) { function countdown (dd) { / / Init target time new Date ( dd ) ; var target = new Date (dd); = target. getTime ( ) ; this. targetTime = target. getTime ();
/ ** * Refresh countdown * / = function ( ) { this. refresh = function () { new Date ( ) ; var today = new Date (); today. getTime ( ) ; var today = currentTime. getTime (); / / Time left ( this . targetTime - currentTime ) ; this. _leftMilliseconds = (this. targetTime - currentTime); Math. floor ( this ._leftMilliseconds / 1000 ) ; this. _leftSeconds = Math. floor (this. _leftMilliseconds / 1000); Math. floor ( this ._leftSeconds / 60 ) ; this. _leftMinutes = Math. floor (this. _leftSeconds / 60); Math. floor ( this ._leftMinutes / 60 ) ; this. _leftHours = Math. floor (this. _leftMinutes / 60); / / No module = Math. floor ( this ._leftHours / 24 ) ; this. leftDays = Math. floor (this. _leftHours / 24); / / For print = this ._leftMilliseconds % 1000 ; this. leftMilliseconds = this. _leftMilliseconds% 1000; = this ._leftSeconds % 60 ; this. leftSeconds = this. _leftSeconds 60%; = this ._leftMinutes % 60 ; this. leftMinutes = this. _leftMinutes 60%; = this ._leftHours % 24 ; this. leftHours = this. _leftHours 24%; } ( ) ; this. refresh (); } |
Example
1 2 3
| new countDown ( '1 1, 2009' ) ; var cd = new CountDown (1 '1, 2009 '); / / Show how many days, hours, minutes, seconds and milliseconds to January 1, 2009 |
More ...
Post in Flash CS3: Create a reflex effect on any MovieClip we had seen what it can write a class that extends MovieClip, to connect it to DesignTime to any MovieClip in the library. I have discovered, however, that may be more useful and economical go through the reverse. I created a class Reflex ( Reflex.as ), intending to use it only to code. I created this class considering moving the pointer in the constructor to a MovieClip. , ma leggermente modificato in modo da poter funzionare espressamente da codice: The new class Reflex contains essentially the same code inserted in the first ReflexMe , but slightly modified so as to work specifically with code:
1 2 3 4
| / / sfx .*; import undolibrary. sfx. *; / / Reflex = new Reflex ( movieClipInstance ) ; var rx: = new Reflex Reflex (movieClipInstance); |
More ...
This is the template that I use for the document class of a generic project Flash CS3:
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
| package { / * ** @ Name: MioDocumento.as ** @ Description: [description] ** @ Author: = undo = @ ** Web: http://www.undolog.com ** @ Email: @ g.fazioli undolog.com - g (dot) Fazioli (at) undolog (dot) com ** @ Version: 1.0 * / .*; import flash.display. *; .*; import flash.events. *; MioDocumento extends MovieClip { MioDocumento public class extends MovieClip { / * Private ** @ var * / MainFive ( ) : void { public function MainFive (): void { Event . ADDED_TO_STAGE , init ) ; addEventListener ( Event . ADDED_TO_STAGE, init); } / * ** @ Name: init () ** @ Description: When trigged added to the Stage * / init ( e : Event ) : void { protected function init (e: Event ): void { / / Todo } } / / Constructor } / / Package |
More ...
I noticed often confusion when it comes to classes, objects and instances. Who is not particularly educated on object-oriented programming often confuses the true meaning of these terms. I knew, however, that there are two schools of thought regarding the definition of Class and Object. I like the "school" that indicates the class definition as a possible subject, and thus the object as instance of the class.
It sounds simple, but it happened to me - talking with others - to be in "conflict" (so to speak) and then fall into confusion, when using these terms, if anything, starting from the premise that "the other" just as we intend them .
I see it in this way, a class is a definition! Is precisely defined class of possible objects. The class is the set of methods and properties (if you want we can also add events - what else ... not only that special methods) that will own the object.
For example, when we write in Actionscript, or any other object-oriented language:
1 2 3 4
| class MyClass { MiaClass function () {} function myMethod () {} } |
We have defined a class and not an object. In the limit we have "defined" a "possible" object. We could even argue, and rightly, that the object exists at runtime while Class not (in truth there are dynamic classes that can be defined - and then used to create objects - even at runtime). Exclude static classes, of course, that - eventually - are nothing more than sub-instances (or instances hidden) and real objects.
But when we:
1
| MiaClasse = new MiaClasse ( ) ; var MyObject: MyClass = new MyClass (); |
! Here mioOggetto is an instance of MiaClasse() ! . That mioOggetto is a subject - in fact - of type MiaClasse() .
. Consequently, their philosophy to objects, objects of type MiaClasse() I can have as many as I want, something that can not be - the very definition - of MiaClasse() . For example, if applies and it makes sense to the relation:
1 2 3 4 5
| MiaClasse = new MiaClasse ( ) ; var mioOggetto_1: MyClass = new MyClass (); MiaClasse = new MiaClasse ( ) ; var mioOggetto_2: MyClass = new MyClass (); MiaClasse = new MiaClasse ( ) ; var mioOggetto_3: MyClass = new MyClass (); ... MiaClasse = new MiaClasse ( ) ; var mioOggetto_n: MyClass = new MyClass (); |
It makes no sense:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| class MyClass { MiaClass function () {} MioMetodo_2 function () {} }
class MyClass { MiaClass function () {} MioMetodo_2 function () {} }
class MyClass { MiaClass function () {} MioMetodo_3 function () {} } |
Object Instance and, therefore, coincide and are used alternately for the same meaning in different contexts.
Probably not much care about anyone ... the question needs to be complete ... 
More ...
For some developers just need to know that there is a new version of their preferred development package to run and buy the upgrade. Others, and rightly so, maintain a more calm and "pretend" to know the actual upturn in the new version before changing their habits. In the case of Adobe Flash CS3 is not much to wait, given the many changes that have suffered from the package when Macromedia was acquired by Adobe.
Here, then, 10 simple, but important, reasons which, in my personal opinion, enough to convince you to upgrade to Adobe Flash CS3 . I will, of course, only the features that impressed me personally, this is not intended as an exhaustive list of all the many changes introduced with the CS3 suite, only a fly to anticipate some features of CS3.
1. Installation
The installation is nice and fast, compared to previous versions. It includes, among other things, with all Adobe products (Dreamweaver CS3, Photoshop CS3 extended, etc ...) which makes installation / removal and update a real pleasure.
2. Backward Compatibility
One issue often overlooked, but always taken into account in the history of Flash: The ability to manage previous versions of the product. In Flash CS3 has all the tools to migrate that to manipulate both the previous versions of our movies. We find this possibility in debugging (debugging a separate Actionscript 2.0 and Actionscript 3.0) is in the process of completing the movie. Immediately write applications in Flash Actionscript 3.0 may be counterproductive in certain contexts. If your target site has a high traffic you may find that many users have not yet installed the latest versions of Flash Player for your browser and then would not see the movie. However, as already said, Flash CS3 allows to develop Flash applications mantendedo backward compatibility and therefore does not see in this a large ostocalo nell'upgrade of the product.
3. GUI and IDE

The IDE Flash CS3 (like Dreamweaver CS3) has been revised to better. The panels (see figure at left), often uncomfortable in previous versions, have been completely redesigned and now their use is less invasive notevolemente.
Besides the possibility to minimize the panels (see figure at right) is found which makes a real nice interface and functionality. When a panel is in icon mode occupies much less space and with a simple click you can open the first main panel always visible.
All the IDE, in short, was reviewed including the central area with the window for editing and graphic code. Do not you point out any changes or you'll ruin the surprise ...

More ...
Here are some tips on how to write good code Object Oriented (OO) in Adobe Flash, especially for those still using version MX waiting to move to CS3.
Organize classes folders
First of all, the organization of the classes makes the job of code maintenance extremely simple. You can also create a real library you can reuse in other projects. Flash uses a nomenclature related to the filesystem, then organize them into folders will also be reflected on the import of classes. For example, if we create the sequence of folders "mylibrary / graphics / plot" and insert our own ActionScript class "PlotClass.as" when we are going to import the class we should use:
1
| grafica . plot . PlotClass ; import mylibrary. graphics. plot. PlotClass; |
If the library (folder) "mylibrary" is not in your movie folder or project, use the Flash publish settings to select the path:

More ...
I use two techniques to extend the functionality of a MovieClip. The first, used in previous versions of Flash MX, used the property prototype , a pointer to the superclass (parent), as indicated in the manual:
A reference to the superclass of a class or function object. The property prototype is automatically created and associated to any class or function object created. This property is static and is specific to the class or function created. If, for example, you create a custom class, the value of properties prototype is shared by all instances of the class and is accessible only as a class property. . Instances of the custom class can not directly access the properties prototype , but can be accessed through the property __proto__ .
One of the advantages of using prototype , especially with the MovieClip, resides in the extension of all the MovieClip, none esluso. In fact you make an extension to broadcast all MovieClip static or dynamic. For example, a convenient extension could be:
1 2 3
| prototype . move = function ( x : Number , y : Number ) { MovieClip . prototype. move = function (x: Number , y: Number ) { _x = x ; this . _y = y ; this. _x = x; this. _y = y; } |
More ...
Latest Comments
Subject : very helpful indeed! I tried it and it is just what I needed. Now I wonder how do I get ...
vik : With strategic help!
Pepper : Hi there, I do not know if you're one of the creators of the WP plugin Bannerize. I have spotted a ...
Rosanna : Can anyone tell me how do I delete the Snap Shots window that opens automatically when I ...
blessed Maresca : I can not download any skypemote me spiegaaa